faster-rcnn-tf2 icon indicating copy to clipboard operation
faster-rcnn-tf2 copied to clipboard

train.py時出現的錯誤代碼

Open 10207011 opened this issue 4 years ago • 20 comments

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

10207011 avatar Dec 05 '20 12:12 10207011

这个是不是版本的问题呐

bubbliiiing avatar Dec 07 '20 06:12 bubbliiiing

这个是不是版本的问题呐

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

WuChengbin avatar Dec 07 '20 08:12 WuChengbin

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

bubbliiiing avatar Dec 14 '20 08:12 bubbliiiing

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

WuChengbin avatar Dec 16 '20 02:12 WuChengbin

暂时解决办法就把下面这行代码 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倍

WuChengbin avatar Dec 17 '20 03:12 WuChengbin

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

bubbliiiing avatar Dec 22 '20 07:12 bubbliiiing

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

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

WuChengbin avatar Dec 22 '20 07:12 WuChengbin

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

bubbliiiing avatar Dec 22 '20 07:12 bubbliiiing

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

bubbliiiing avatar Dec 22 '20 07:12 bubbliiiing

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

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

WuChengbin avatar Dec 22 '20 07:12 WuChengbin

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

bubbliiiing avatar Dec 22 '20 07:12 bubbliiiing

這要怎麼改成float32?

WuChengbin [email protected]於 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 https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-745723548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ .

10207011 avatar Dec 22 '20 07:12 10207011

numpy 数组数据类型转换

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 10207011 <[email protected]> 发送时间: 2020年12月22日 15:27 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> 抄送: WuChengbin <[email protected]>, Comment <[email protected]> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2)

這要怎麼改成float32?

WuChengbin <[email protected]>於 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 > <https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-745723548>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ> > . >

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

WuChengbin avatar Dec 22 '20 10:12 WuChengbin

用tf.cast轉? 我用float()沒法轉

WuChengbin [email protected]於 2020年12月22日 週二,18:40寫道:

numpy 数组数据类型转换

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 10207011 <[email protected]> 发送时间: 2020年12月22日 15:27 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> 抄送: WuChengbin <[email protected]>, Comment <[email protected]>

主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2)

這要怎麼改成float32?

WuChengbin <[email protected]>於 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 > < https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-745723548>,

> or unsubscribe > < https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ>

> . >

— 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 https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-749475173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ5FBB7DCKQVAH6GLXU2XFLSWBZSPANCNFSM4UOQTBDQ .

10207011 avatar Dec 22 '20 11:12 10207011

nparray.astype(‘float32’)

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 10207011 <[email protected]> 发送时间: 2020年12月22日 19:35 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> 抄送: WuChengbin <[email protected]>, Comment <[email protected]> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2)

用tf.cast轉? 我用float()沒法轉

WuChengbin <[email protected]>於 2020年12月22日 週二,18:40寫道:

> numpy 数组数据类型转换 > > > 发自我的iPhone > > ------------------ 原始邮件 ------------------ > 发件人: 10207011 <[email protected]&gt; > 发送时间: 2020年12月22日 15:27 > 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]&gt; > 抄送: WuChengbin <[email protected]&gt;, Comment <[email protected]&gt; > > 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) > > > > > > 這要怎麼改成float32? > > WuChengbin <[email protected]&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; < > https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-745723548&gt;, > > &gt; or unsubscribe > &gt; < > https://github.com/notifications/unsubscribe-auth/AQ5FBBYNTEM3RQDXVQ5RKTDSVALZPANCNFSM4UOQTBDQ&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 > <https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-749475173>, > 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.

WuChengbin avatar Dec 22 '20 11:12 WuChengbin

nparray.astype(‘float32’) 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: 10207011 <[email protected]> 发送时间: 2020年12月22日 19:35 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> 抄送: WuChengbin <[email protected]>, Comment <[email protected]> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) 用tf.cast轉? 我用float()沒法轉 WuChengbin <[email protected]>於 2020年12月22日 週二,18:40寫道: > numpy 数组数据类型转换 > > > 发自我的iPhone > > ------------------ 原始邮件 ------------------ > 发件人: 10207011 <[email protected]&gt; > 发送时间: 2020年12月22日 15:27 > 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]&gt; > 抄送: WuChengbin <[email protected]&gt;, Comment <[email protected]&gt; > > 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) > > > > > > 這要怎麼改成float32? > > WuChengbin <[email protected]&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&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’) 請問這要打在哪一行後?

10207011 avatar Dec 27 '20 09:12 10207011

nparray.astype(‘float32’)

nparray.astype(‘float32’) 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: 10207011 <[email protected]> 发送时间: 2020年12月22日 19:35 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> 抄送: WuChengbin <[email protected]>, Comment <[email protected]> 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) 用tf.cast轉? 我用float()沒法轉 WuChengbin <[email protected]>於 2020年12月22日 週二,18:40寫道: > numpy 数组数据类型转换 > > > 发自我的iPhone > > ------------------ 原始邮件 ------------------ > 发件人: 10207011 <[email protected]> > 发送时间: 2020年12月22日 15:27 > 收件人: bubbliiiing/faster-rcnn-tf2 <[email protected]> > 抄送: WuChengbin <[email protected]>, Comment <[email protected]> > > 主题: 回复:[bubbliiiing/faster-rcnn-tf2] train.py時出現的錯誤代碼 (#2) > > > > > > 這要怎麼改成float32? > > WuChengbin <[email protected]>於 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&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’) ?感覺怪怪的 如果我要加,是加到哪行?

10207011 avatar Dec 27 '20 09:12 10207011

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

10207011 avatar Dec 27 '20 09:12 10207011

train_on_batch这个函数的参数全部转成float32或者float64

发自我的iPhone

在 2020年12月27日,17:51,10207011 [email protected] 写道:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

WuChengbin avatar Dec 29 '20 09:12 WuChengbin

請問能給個範例嗎?

WuChengbin [email protected]於 2020年12月29日 週二,17:24寫道:

train_on_batch这个函数的参数全部转成float32或者float64

发自我的iPhone

在 2020年12月27日,17:51,10207011 [email protected] 写道:

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

— 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 https://github.com/bubbliiiing/faster-rcnn-tf2/issues/2#issuecomment-752009132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ5FBB2X3ZA6C7K3AM7GWJDSXGN45ANCNFSM4UOQTBDQ .

10207011 avatar Dec 30 '20 13:12 10207011