bubbliiiing/faster-rcnn-tf2

train.py時出現的錯誤代碼

10207011 opened this issue · 20 comments

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type int32 of argument 'x'.

这个是不是版本的问题呐

这个是不是版本的问题呐

我也有这个问题,我用的 tensorflow 2.4 rc0版本 RTX3090的 GPU

啊这,我这只有1660super,不知道2.4的差别

暂时解决办法就把下面这行代码 X X2 Y1 Y2全部转成float32,但是影响速度
loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, :]], [Y1[:, sel_samples, :], Y2[:, sel_samples, :]])

暂时解决办法就把下面这行代码 X X2 Y1 Y2全部转成float32,但是影响速度
loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, :]], [Y1[:, sel_samples, :], Y2[:, sel_samples, :]])

相比Keras版本,TF2的速度慢了差不多1倍

其实就是版本的问题,转换类型好像会花时间,我这边是tf2版本更快。

其实就是版本的问题,转换类型好像会花时间,我这边是tf2版本更快。

是的,我测试了TF2.2 没有这个问题,2.3及以上都不行,我现在TF2的版本用的3090,Keras那个版本用的2080Ti。比TF2,应该是时间花费在转换上了,而且全部转为float内存开销也大了

可以试试转换成别的type,统一转换应该会快一些,具体的我也不太清楚了,我没有适配那么高版本因为我也没有卡……

不过适配了高版本,低版本也就不能用了,问题还挺麻烦的

不过适配了高版本,低版本也就不能用了,问题还挺麻烦的

主要是现在还没有官方版本的TF2.x 适配 RTX30 系列的卡,自己编译的TF2.x 可能也有影响。还是挺麻烦的

是的这个问题极大的浇灭了我买30显卡的欲望……

nparray.astype(‘float32’) 发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 10207011 <notifications@github.com> 发送时间: 2020年12月22日 19:35 收件人: bubbliiiing/faster-rcnn-tf2 <faster-rcnn-tf2@noreply.github.com> 抄送: WuChengbin <892534877@qq.com>, Comment <comment@noreply.github.com> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) 用tf.cast轉? 我用float()沒法轉 WuChengbin <notifications@github.com>於 2020年12月22日 週二,18:40寫道: > numpy 数组数据类型转换 > > > 发自我的iPhone > > ------------------ 原始邮件 ------------------ > 发件人: 10207011 <notifications@github.com&gt; > 发送时间: 2020年12月22日 15:27 > 收件人: bubbliiiing/faster-rcnn-tf2 <faster-rcnn-tf2@noreply.github.com&gt; > 抄送: WuChengbin <892534877@qq.com&gt;, Comment <comment@noreply.github.com&gt; > > 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) > > > > > > 這要怎麼改成float32? > > WuChengbin <notifications@github.com&gt;於 2020年12月16日 週三,10:31寫道: > > &gt; 暂时解决办法就把下面这行代码 X X2 Y1 Y2全部转成float32,但是影响速度 > &gt; loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, > :]], > &gt; [Y1[:, sel_samples, :], Y2[:, sel_samples, :]]) > &gt; > &gt; — > &gt; You are receiving this because you authored the thread. > &gt; Reply to this email directly, view it on GitHub > &gt; < > #2 (comment)&gt;, > > &gt; or unsubscribe > &gt; < > https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ&amp;gt; > > &gt; . > &gt; > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub, or unsubscribe. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <#2 (comment)>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AQ5FBB7DCKQVAH6GLXU2XFLSWBZSPANCNFSM4UOQTBDQ> > . > — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

nparray.astype(‘float32’)
請問這要打在哪一行後?

nparray.astype(‘float32’)

nparray.astype(‘float32’) 发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 10207011 <notifications@github.com> 发送时间: 2020年12月22日 19:35 收件人: bubbliiiing/faster-rcnn-tf2 <faster-rcnn-tf2@noreply.github.com> 抄送: WuChengbin <892534877@qq.com>, Comment <comment@noreply.github.com> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) 用tf.cast轉? 我用float()沒法轉 WuChengbin <notifications@github.com>於 2020年12月22日 週二,18:40寫道: > numpy 数组数据类型转换 > > > 发自我的iPhone > > ------------------ 原始邮件 ------------------ > 发件人: 10207011 <notifications@github.com> > 发送时间: 2020年12月22日 15:27 > 收件人: bubbliiiing/faster-rcnn-tf2 <faster-rcnn-tf2@noreply.github.com> > 抄送: WuChengbin <892534877@qq.com>, Comment <comment@noreply.github.com> > > 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) > > > > > > 這要怎麼改成float32? > > WuChengbin <notifications@github.com>於 2020年12月16日 週三,10:31寫道: > > > 暂时解决办法就把下面这行代码 X X2 Y1 Y2全部转成float32,但是影响速度 > > loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, > :]], > > [Y1[:, sel_samples, :], Y2[:, sel_samples, :]]) > > > > — > > You are receiving this because you authored the thread. > > Reply to this email directly, view it on GitHub > > < > #2 (comment)>, > > > or unsubscribe > > < > https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ&amp;gt; > > > . > > > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub, or unsubscribe. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <#2 (comment)>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/AQ5FBB7DCKQVAH6GLXU2XFLSWBZSPANCNFSM4UOQTBDQ > . > — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

nparray.astype(‘float32’)
請問這要打在哪一行後?

X=nparray.astype(‘float32’) ?感覺怪怪的 如果我要加,是加到哪行?

直接打在
loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, :]], [Y1[:, sel_samples, :], Y2[:, sel_samples, :]]) 上方?