当前位置: 首页 > news >正文

tensorflow keras Model.fit returning: ValueError: Unrecognized data type

题意:TensorFlow Keras 的 Model.fit 方法返回了一个 ValueError,提示数据类型无法识别

问题背景:

I'm trying to train a keras model with 2 inputs: an image part that's a tf.data.Dataset and a nor mal part represented by a pd.DataFrame

from tensorflow.keras.optimizers import Adam
opt = Adam(learning_rate=1e-3, decay=1e-3 / 200)model.compile(loss="mean_absolute_percentage_error", optimizer=opt)model.fit(x=[df.loc[:, df.columns != 'target'], ds.batch(8)], y=df["target"],epochs=200)

I was trying to fit the model but I get ValueError

ValueError: Unrecognized data type: x=[...][401059 rows x 52 columns]
, <_BatchDataset element_spec=(TensorSpec(shape=(None, 32, 256, 256, 3), 
dtype=tf.float32, name=None), 
TensorSpec(shape=(None, 32, 256, 256, 3), dtype=tf.float32, name=None))>] (of type <class 'list'>)

问题解决:

the problem was an error in tensoflow zipping and reformating dataset helped

def post_zip_process(example1, example2):reshaped_input = tf.transpose(example1[0], [0, 1, 2 ,-1])reshaped_input = reshaped_input[0, :, :, :]print(reshaped_input.shape)return (reshaped_input, example2[0]), example1[1]

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • WordPress外贸建站案例
  • 基于JAVA+SpringBoot+Vue+uniApp的校园日常作品商品分享小程序
  • 航班管理系统【C语言版】单文件编写
  • MPNN消息传递神经网络
  • IDEA的断点调试(Debug)
  • Ajax是什么?如何在HTML5中使用Ajax?
  • 分享一个 .NET EF 6 扩展 Where 的方法
  • ES6 字符串的新增方法(二十)
  • P4-AI产品经理-九五小庞
  • 云原生系列 - Jenkins
  • (C++二叉树05) 合并二叉树 二叉搜索树中的搜索 验证二叉搜索树
  • 【JavaScript 算法】最长公共子序列:字符串问题的经典解法
  • [数据集][目标检测]导盲犬拐杖检测数据集VOC+YOLO格式4635张2类别
  • RK3568 V1.4.0 SDK,USB OTG端子不能被电脑识别出adb设备,解决
  • “信息科技风险管理”和“IT审计智能辅助”两个大模块的部分功能详细介绍:
  • 4个实用的微服务测试策略
  • Android Volley源码解析
  • AngularJS指令开发(1)——参数详解
  • CSS3 变换
  • es6
  • Fabric架构演变之路
  • Fundebug计费标准解释:事件数是如何定义的?
  • maven工程打包jar以及java jar命令的classpath使用
  • Python3爬取英雄联盟英雄皮肤大图
  • quasar-framework cnodejs社区
  • React-生命周期杂记
  • SpingCloudBus整合RabbitMQ
  • Vue2.0 实现互斥
  • Webpack 4x 之路 ( 四 )
  • 个人博客开发系列:评论功能之GitHub账号OAuth授权
  • 基于Dubbo+ZooKeeper的分布式服务的实现
  • 什么是Javascript函数节流?
  • 移动端解决方案学习记录
  • 400多位云计算专家和开发者,加入了同一个组织 ...
  • Linux权限管理(week1_day5)--技术流ken
  • 教程:使用iPhone相机和openCV来完成3D重建(第一部分) ...
  • ​linux启动进程的方式
  • #我与Java虚拟机的故事#连载12:一本书带我深入Java领域
  • $forceUpdate()函数
  • (16)UiBot:智能化软件机器人(以头歌抓取课程数据为例)
  • (4) openssl rsa/pkey(查看私钥、从私钥中提取公钥、查看公钥)
  • (附源码)spring boot球鞋文化交流论坛 毕业设计 141436
  • (七)微服务分布式云架构spring cloud - common-service 项目构建过程
  • (转)socket Aio demo
  • (转)创业家杂志:UCWEB天使第一步
  • .net 7和core版 SignalR
  • .Net Core 中间件验签
  • .NET Core/Framework 创建委托以大幅度提高反射调用的性能
  • .Net Core与存储过程(一)
  • .NET delegate 委托 、 Event 事件,接口回调
  • .NET Framework 3.5中序列化成JSON数据及JSON数据的反序列化,以及jQuery的调用JSON
  • .NET Project Open Day(2011.11.13)
  • .NET 动态调用WebService + WSE + UsernameToken
  • .net 获取url的方法
  • .Net6支持的操作系统版本(.net8已来,你还在用.netframework4.5吗)