sagieppel / Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch

Fully convolutional neural network (FCN) for pixelwise annotation (semantic segmentation) of images implemented on python pytorch.
49 stars 16 forks source link

Can the code run in CPU? #2

Closed xll98 closed 4 years ago

xll98 commented 4 years ago

Thanks for your code,but i meet some error as:

File "D:\Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch\NET_FCN.py", line 77, in forward for i in range(len(RGBMean)): InpImages[:, i, :, :]=(InpImages[:, i, :, :]-RGBMean[i])/RGBStd[i] # normalize image values RuntimeError: "add" not implemented for 'torch.HalfTensor'

xll98 commented 4 years ago

Another case: File "D:\Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch\NET_FCN.py", line 77, in forward for i in range(len(RGBMean)): InpImages[:, i, :, :]=(InpImages[:, i, :, :]-RGBMean[i])/RGBStd[i] # normalize image values RuntimeError: "add_cpu/sub_cpu" not implemented for 'Half'

sagieppel commented 4 years ago

Seem like you try to run on cpu. Never try it before so I am not sure. But it seem the problem is with the net being in half mode maybe try to convert float.

On Wed, Nov 20, 2019 at 11:34 PM xll98 notifications@github.com wrote:

Another case: File "D:\Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch\NET_FCN.py", line 77, in forward for i in range(len(RGBMean)): InpImages[:, i, :, :]=(InpImages[:, i, :, :]-RGBMean[i])/RGBStd[i] # normalize image values RuntimeError: "add_cpu/sub_cpu" not implemented for 'Half'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&email_token=AB37V522VC3LVBIEL45NU33QUYFUNA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEY5YFQ#issuecomment-556915734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB37V54IPCQJRS7ULB4RVCTQUYFUNANCNFSM4JP4MQAQ .

xll98 commented 4 years ago

Thanks for your answer,i'm gong to use tensorflow to try,because there is no Navi.I find it can run on CPU what you share in "https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation" .But the links of "Trained model"no longer work.Would you like to sunbmit it again?

sagieppel commented 4 years ago

All the link for this repository work. The tensorflow thing a really old code you might want to look for something newer

On Thu, 21 Nov 2019, 10:47 xll98 notifications@github.com wrote:

Thanks for your answer,i'm gong to use tensorflow to try,because there is no Navi.I find it can run on CPU what you share in " https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation" .But the links of "Trained model"no longer work.Would you like to sunbmit it again?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&email_token=AB37V54TB5NP4UQ7OBY3Z5LQUZDKLA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZNXUY#issuecomment-556981203, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB37V53CPIYU44VARJ6PO4TQUZDKLANCNFSM4JP4MQAQ .

xll98 commented 4 years ago

10 I used to try to test this image by your code(with pytorch) in other computer with Niva.But the results were not as good as expected

sagieppel commented 4 years ago

Working on it :-). The image is really big try to resize it to half size or less you might get significant improvement. Newer better model will be released within a month or so. Also i am in the process of building larger dataset for images from chemistry labs of materials in vessel if you happened to have images you want to contribute it will help make future models better. (all for public non profit work)

On Thu, Nov 21, 2019 at 5:27 AM xll98 notifications@github.com wrote:

[image: 10] https://user-images.githubusercontent.com/49185575/69329347-e1698d80-0c8b-11ea-9f98-fc91c3d0f9dd.jpg I used to try to test this image by your code(with pytorch) in other computer with Niva.But the results were not as good as expected

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&email_token=AB37V57OUDXPPC3BXKW63VTQUZPCRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ .

xll98 commented 4 years ago

there are some videos what are supposed to help for your mode.(I'm sorry, I don't have a lot of data) In past versions, some of the images captured in video were difficult to identify 

------------------ 原始邮件 ------------------ 发件人: "sagieppel"<notifications@github.com>; 发送时间: 2019年11月21日(星期四) 晚上7:18 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch"<Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch@noreply.github.com>; 抄送: "_Xll"<769349379@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch] Can the code run in CPU? (#2)

Working on it :-). The image is really big try to resize it to half size or less you might get significant improvement. Newer better model will be released within a month or so. Also i am in the process of building larger dataset for images from chemistry labs of materials in vessel if you happened to have images you want to contribute it will help make future models better. (all for public non profit work)

On Thu, Nov 21, 2019 at 5:27 AM xll98 <notifications@github.com> wrote:

> [image: 10] > <https://user-images.githubusercontent.com/49185575/69329347-e1698d80-0c8b-11ea-9f98-fc91c3d0f9dd.jpg&gt; > I used to try to test this image by your code(with pytorch) in other > computer with Niva.But the results were not as good as expected > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&amp;email_token=AB37V57OUDXPPC3BXKW63VTQUZPCRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989&gt;, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ&gt; > . >

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

从QQ邮箱发来的超大附件

d-short.zip (176.26M, 2019年12月22日 10:31 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=7566343045d79ac03631ef1d1e37531b025f06065951535618000251591a550d015e19515d030219575356520e06000d02045107383c615018155c5f4a434f4e5c16340d&code=5f4087a4

xll98 commented 4 years ago

If the previous link is invalid, you can use the following link https://drive.google.com/file/d/1fa7R05ehChLeBC_R1CDKWAAtirNw1uH_/view?usp=sharing

------------------ 原始邮件 ------------------ 发件人: "sagieppel"<notifications@github.com>; 发送时间: 2019年11月21日(星期四) 晚上7:18 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch"<Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch@noreply.github.com>; 抄送: "_Xll"<769349379@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch] Can the code run in CPU? (#2)

Working on it :-). The image is really big try to resize it to half size or less you might get significant improvement. Newer better model will be released within a month or so. Also i am in the process of building larger dataset for images from chemistry labs of materials in vessel if you happened to have images you want to contribute it will help make future models better. (all for public non profit work)

On Thu, Nov 21, 2019 at 5:27 AM xll98 <notifications@github.com> wrote:

> [image: 10] > <https://user-images.githubusercontent.com/49185575/69329347-e1698d80-0c8b-11ea-9f98-fc91c3d0f9dd.jpg&gt; > I used to try to test this image by your code(with pytorch) in other > computer with Niva.But the results were not as good as expected > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&amp;email_token=AB37V57OUDXPPC3BXKW63VTQUZPCRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989&gt;, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ&gt; > . >

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

iliskhan commented 4 years ago

in Inference.py change line 25 on "Net=NET_FCN.Net(NumClasses=NUM_CLASSES, UseGPU=False)" line 26 on "Net.load_state_dict(torch.load(Trained_model_path, map_location=torch.device('cpu')))" and comment line 28.

in NET_FCN.py on line 72 change "torch.HalfTensor" to "torch.FloatTensor"

It works for me.

xll98 commented 4 years ago

in Inference.py change line 25 on "Net=NET_FCN.Net(NumClasses=NUM_CLASSES, UseGPU=False)" line 26 on "Net.load_state_dict(torch.load(Trained_model_path, map_location=torch.device('cpu')))" and comment line 28.

in NET_FCN.py on line 72 change "torch.HalfTensor" to "torch.FloatTensor"

It works for me.

thanks

xll98 commented 4 years ago

正在处理:-)。图像确实很大,尝试将其调整为一半或更小尺寸,您可能会获得显着改善。较新的更好模型将在一个月左右的时间内发布。另外,如果您碰巧想要提供图像,那么我也正在为容器材料化学实验室的图像建立更大的数据集,这将有助于改进将来的模型。(全部用于公共非营利性工作) 在2019年11月21日星期四上午5:27 xll98 @.***>写道:[image:10] < https://user-images.githubusercontent.com/49185575/69329347-e1698d80 -0c8b-11ea-9f98-fc91c3d0f9dd.jpg >我曾经尝试用Niva在其他计算机上通过您的代码(使用pytorch)测试此图像。但是结果不如预期的好-您收到此评论是因为您发表了评论。回复此电子邮件直接,查看它在GitHub < #2?email_source =通知&email_token = AB37V57OUDXPPC3BXKW63VTQUZP​​CRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989>,或取消订阅< https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ >。

Hi,has the new model been updated?

sagieppel commented 4 years ago

Not yet sorry, my estimation is two to three weeks. I will let you know when I put it on git. Thanks for the image by the way.

sagieppel commented 4 years ago

Hey I uploaded new network with much better performance on liquid level vessels detection, it will probably work better with your images: see code here: https://github.com/sagieppel/Detecting-and-segmenting-and-classifying-materials-inside-vessels-in-images-using-convolutional-net

sagieppel commented 4 years ago

Hey, I uploaded a new network with much better performance on the liquid level and vessel detection, it will probably work better with your images. see code here: https://github.com/sagieppel/Detecting-and-segmenting-and-classifying-materials-inside-vessels-in-images-using-convolutional-net

On Thu, Dec 26, 2019 at 11:26 PM xll98 notifications@github.com wrote:

正在处理:-)。图像确实很大,尝试将其调整为一半或更小尺寸,您可能会获得显着改善。较新的更好模型将在一个月左右的时间内发布。另外,如果您碰巧想要提供图像,那么我也正在为容器材料化学实验室的图像建立更大的数据集,这将有助于改进将来的模型。(全部用于公共非营利性工作) … <#m7446906817802653903> 在2019年11月21日星期四上午5:27 xll98 @.***>写道:[image:10] < https://user-images.githubusercontent.com/49185575/69329347-e1698d80 -0c8b-11ea-9f98-fc91c3d0f9dd.jpg https://user-images.githubusercontent.com/49185575/69329347-e1698d80-0c8b-11ea-9f98-fc91c3d0f9dd.jpg

我曾经尝试用Niva在其他计算机上通过您的代码(使用pytorch)测试此图像。但是结果不如预期的好-您收到此评论是因为您发表了评论。回复此电子邮件直接,查看它在GitHub < #2 https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source =通知&email_token = AB37V57OUDXPPC3BXKW63VTQUZP​​CRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989>,或取消订阅<

https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ

Hi,has the new model been updated?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&email_token=AB37V5YMPIO5T2IGKSOY3KTQ2V7V5A5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHWRADQ#issuecomment-569184270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB37V5YANPLZSFBHZEAQTU3Q2V7V5ANCNFSM4JP4MQAQ .

xll98 commented 4 years ago

Thank you very much for your new net.

------------------ 原始邮件 ------------------ 发件人: "sagieppel"<notifications@github.com>; 发送时间: 2020年1月5日(星期天) 凌晨4:00 收件人: "sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch"<Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch@noreply.github.com>; 抄送: "_Xll"<769349379@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch] Can the code run in CPU? (#2)

Hey, I uploaded a new network with much better performance on the liquid level and vessel detection, it will probably work better with your images. see code here: https://github.com/sagieppel/Detecting-and-segmenting-and-classifying-materials-inside-vessels-in-images-using-convolutional-net

On Thu, Dec 26, 2019 at 11:26 PM xll98 <notifications@github.com> wrote:

> > 正在处理:-)。图像确实很大,尝试将其调整为一半或更小尺寸,您可能会获得显着改善。较新的更好模型将在一个月左右的时间内发布。另外,如果您碰巧想要提供图像,那么我也正在为容器材料化学实验室的图像建立更大的数据集,这将有助于改进将来的模型。(全部用于公共非营利性工作) > … <#m7446906817802653903> > 在2019年11月21日星期四上午5:27 xll98 @.***>写道:[image:10] < https://user-images.githubusercontent.com/49185575/69329347-e1698d80 > -0c8b-11ea-9f98-fc91c3d0f9dd.jpg > <https://user-images.githubusercontent.com/49185575/69329347-e1698d80-0c8b-11ea-9f98-fc91c3d0f9dd.jpg&gt; > >我曾经尝试用Niva在其他计算机上通过您的代码(使用pytorch)测试此图像。但是结果不如预期的好-您收到此评论是因为您发表了评论。回复此电子邮件直接,查看它在GitHub > < #2 > <https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2&gt;?email_source > =通知&email_token = > AB37V57OUDXPPC3BXKW63VTQUZP​​CRA5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZXOPI#issuecomment-557020989>,或取消订阅< > > https://github.com/notifications/unsubscribe-auth/AB37V5ZZR7NHNY3WWZGORFDQUZPCRANCNFSM4JP4MQAQ > >。 > > Hi,has the new model been updated? > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/sagieppel/Fully-convolutional-neural-network-FCN-for-semantic-segmentation-with-pytorch/issues/2?email_source=notifications&amp;email_token=AB37V5YMPIO5T2IGKSOY3KTQ2V7V5A5CNFSM4JP4MQA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHWRADQ#issuecomment-569184270&gt;, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AB37V5YANPLZSFBHZEAQTU3Q2V7V5ANCNFSM4JP4MQAQ&gt; > . >

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