DeepTrial / Retina-VesselNet

A Simple U-net model for Retinal Blood Vessel Segmentation based on tensorflow2
305 stars 76 forks source link

Hello author, I am getting an error when running main_test, py file #33

Closed Feiyuanyu closed 3 years ago

Feiyuanyu commented 5 years ago

Hello, I have reported an error while running the main_test.py file without changing any data or code.Hello, I have reported an error while running the main_test.py file without changing any data or code. TIM图片20190728195505 TIM图片20190728195512

Feiyuanyu commented 5 years ago

I only get two images in the results folder, and the two images in the result folder are always changing when I run the main_test.py file.

DeepTrial commented 5 years ago

sorry to be late. i thought u have to check that whether the main_test.py code have load all the test images and their groundtruths. i do the test in win10 and maybe there are some difference on ubuntu.

fubai3 commented 5 years ago

您好,我用自己的图片测试的时候遇到了同样的问题,请问您是怎么解决的

fubai3 commented 5 years ago

您好,我用自己的图片测试的时候遇到了同样的问题,请问您是怎么解决的

SIAT-liyang commented 5 years ago

I only get two images in the results folder, and the two images in the result folder are always changing when I run the main_test.py file.

I have the same problem. Because of the path, there is a problem with the code here in XXX. The file name is not read out. All the saved files will be overwritten by the saved files. Here is my solution(in segmention_infer.py): ` def predict(self):

    predList=glob.glob(self.config.test_img_path+"*."+self.config.test_datatype)

    i = 0

    for path in predList:

        orgImg_temp=plt.imread(path)
        orgImg=orgImg_temp[:,:,1]*0.75+orgImg_temp[:,:,0]*0.25
        print("[Info] Analyze filename...",self.analyze_name(path))
        height,width=orgImg.shape[:2]
        orgImg = np.reshape(orgImg, (height,width,1))
        patches_pred,new_height,new_width,adjustImg=get_test_patches(orgImg,self.config)
        predictions = self.model.predict(patches_pred, batch_size=32, verbose=1)
        pred_patches=pred_to_patches(predictions,self.config)
        pred_imgs=recompone_overlap(pred_patches,self.config,new_height,new_width)
        pred_imgs=pred_imgs[:,0:height,0:width,:]
        adjustImg=adjustImg[0,0:height,0:width,:]
        print(adjustImg.shape)
        probResult=pred_imgs[0,:,:,0]
        binaryResult=gray2binary(probResult)
        resultMerge=visualize([adjustImg,binaryResult],[1,2])
        resultMerge=cv2.cvtColor(resultMerge,cv2.COLOR_RGB2BGR)
        i=i+1
        cv2.imwrite(self.config.test_result_path+str(i)+"_merge.jpg",resultMerge)
        cv2.imwrite(self.config.test_result_path+str(i)+ "_prob.bmp", (probResult*255).astype(np.uint8))

`

fubai3 commented 5 years ago

谢谢您的回复,您训练的时候loss能下降到多少,我有110张训练图片,65张验证图片,训练了120个epoch后结果如下

测试效果并不好,请问是epoch少了还是什么原因呢 ------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:39 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33)

Hello, I have reported an error while running the main_test.py file without changing any data or code.Hello, I have reported an error while running the main_test.py file without changing any data or code.

I have the same problem. Because of the path, there is a problem with the code here in XXX. The file name is not read out. All the saved files will be overwritten by the saved files. Here is my solution(in segmention_infer.py): def predict(self): predList=glob.glob(self.config.test_img_path+"*."+self.config.test_datatype) i = 0 for path in predList: orgImg_temp=plt.imread(path) orgImg=orgImg_temp[:,:,1]*0.75+orgImg_temp[:,:,0]*0.25 print("[Info] Analyze filename...",self.analyze_name(path)) height,width=orgImg.shape[:2] orgImg = np.reshape(orgImg, (height,width,1)) patches_pred,new_height,new_width,adjustImg=get_test_patches(orgImg,self.config) predictions = self.model.predict(patches_pred, batch_size=32, verbose=1) pred_patches=pred_to_patches(predictions,self.config) pred_imgs=recompone_overlap(pred_patches,self.config,new_height,new_width) pred_imgs=pred_imgs[:,0:height,0:width,:] adjustImg=adjustImg[0,0:height,0:width,:] print(adjustImg.shape) probResult=pred_imgs[0,:,:,0] binaryResult=gray2binary(probResult) resultMerge=visualize([adjustImg,binaryResult],[1,2]) resultMerge=cv2.cvtColor(resultMerge,cv2.COLOR_RGB2BGR) **i=i+1** cv2.imwrite(self.config.test_result_path+**str(i)**+"_merge.jpg",resultMerge) cv2.imwrite(self.config.test_result_path+**str(i)**+ "_prob.bmp", (probResult*255).astype(np.uint8))

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

SIAT-liyang commented 5 years ago

您好,我用自己的图片测试的时候遇到了同样的问题,请问您是怎么解决的

我也遇到了同样的问题。由于路径的原因,segmention_infer.py最后两行的代码有问题,没有读取出文件名,所有每次保存的文件将原来已经保存的文件覆盖掉了,添加一个计数器i来重新命名就行了

SIAT-liyang commented 5 years ago

谢谢您的回复,您训练的时候loss能下降到多少,我有110张训练图片,65张验证图片,训练了120个epoch后结果如下 测试效果并不好,请问是epoch少了还是什么原因呢 ------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:39 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33) Hello, I have reported an error while running the main_test.py file without changing any data or code.Hello, I have reported an error while running the main_test.py file without changing any data or code. I have the same problem. Because of the path, there is a problem with the code here in XXX. The file name is not read out. All the saved files will be overwritten by the saved files. Here is my solution(in segmention_infer.py): def predict(self): predList=glob.glob(self.config.test_img_path+"*."+self.config.test_datatype) i = 0 for path in predList: orgImg_temp=plt.imread(path) orgImg=orgImg_temp[:,:,1]*0.75+orgImg_temp[:,:,0]*0.25 print("[Info] Analyze filename...",self.analyze_name(path)) height,width=orgImg.shape[:2] orgImg = np.reshape(orgImg, (height,width,1)) patches_pred,new_height,new_width,adjustImg=get_test_patches(orgImg,self.config) predictions = self.model.predict(patches_pred, batch_size=32, verbose=1) pred_patches=pred_to_patches(predictions,self.config) pred_imgs=recompone_overlap(pred_patches,self.config,new_height,new_width) pred_imgs=pred_imgs[:,0:height,0:width,:] adjustImg=adjustImg[0,0:height,0:width,:] print(adjustImg.shape) probResult=pred_imgs[0,:,:,0] binaryResult=gray2binary(probResult) resultMerge=visualize([adjustImg,binaryResult],[1,2]) resultMerge=cv2.cvtColor(resultMerge,cv2.COLOR_RGB2BGR) **i=i+1** cv2.imwrite(self.config.test_result_path+**str(i)**+"_merge.jpg",resultMerge) cv2.imwrite(self.config.test_result_path+**str(i)**+ "_prob.bmp", (probResult*255).astype(np.uint8)) — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

看不到你的测试效果

fubai3 commented 5 years ago

您好,这是我训练了120个epoch后的日志和测试图片,效果并不好,是epoch少了还是其他原因呢,谢谢 ------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:51 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33)

谢谢您的回复,您训练的时候loss能下降到多少,我有110张训练图片,65张验证图片,训练了120个epoch后结果如下 测试效果并不好,请问是epoch少了还是什么原因呢 ------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:39 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33) Hello, I have reported an error while running the main_test.py file without changing any data or code.Hello, I have reported an error while running the main_test.py file without changing any data or code. I have the same problem. Because of the path, there is a problem with the code here in XXX. The file name is not read out. All the saved files will be overwritten by the saved files. Here is my solution(in segmention_infer.py): def predict(self): predList=glob.glob(self.config.test_img_path+"."+self.config.test_datatype) i = 0 for path in predList: orgImg_temp=plt.imread(path) orgImg=orgImg_temp[:,:,1]0.75+orgImg_temp[:,:,0]0.25 print("[Info] Analyze filename...",self.analyze_name(path)) height,width=orgImg.shape[:2] orgImg = np.reshape(orgImg, (height,width,1)) patches_pred,new_height,new_width,adjustImg=get_test_patches(orgImg,self.config) predictions = self.model.predict(patches_pred, batch_size=32, verbose=1) pred_patches=pred_to_patches(predictions,self.config) pred_imgs=recompone_overlap(pred_patches,self.config,new_height,new_width) pred_imgs=pred_imgs[:,0:height,0:width,:] adjustImg=adjustImg[0,0:height,0:width,:] print(adjustImg.shape) probResult=pred_imgs[0,:,:,0] binaryResult=gray2binary(probResult) resultMerge=visualize([adjustImg,binaryResult],[1,2]) resultMerge=cv2.cvtColor(resultMerge,cv2.COLOR_RGB2BGR) i=i+1 cv2.imwrite(self.config.test_result_path+str(i)+"_merge.jpg",resultMerge) cv2.imwrite(self.config.test_result_path+str(i)+ "_prob.bmp", (probResult255).astype(np.uint8)) — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

看不到你的测试效果

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

fubai3 commented 5 years ago

您好,方便加您qq或微信咨询吗,我发了图片没显示

------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:51 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33)

谢谢您的回复,您训练的时候loss能下降到多少,我有110张训练图片,65张验证图片,训练了120个epoch后结果如下 测试效果并不好,请问是epoch少了还是什么原因呢 ------------------ 原始邮件 ------------------ 发件人: "SIAT-liyang"notifications@github.com; 发送时间: 2019年10月28日(星期一) 下午4:39 收件人: "DeepTrial/Retina-VesselNet"Retina-VesselNet@noreply.github.com; 抄送: "℡ 深海的鱼"1165269652@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [DeepTrial/Retina-VesselNet] Hello author, I am getting an errorwhen running main_test, py file (#33) Hello, I have reported an error while running the main_test.py file without changing any data or code.Hello, I have reported an error while running the main_test.py file without changing any data or code. I have the same problem. Because of the path, there is a problem with the code here in XXX. The file name is not read out. All the saved files will be overwritten by the saved files. Here is my solution(in segmention_infer.py): def predict(self): predList=glob.glob(self.config.test_img_path+"."+self.config.test_datatype) i = 0 for path in predList: orgImg_temp=plt.imread(path) orgImg=orgImg_temp[:,:,1]0.75+orgImg_temp[:,:,0]0.25 print("[Info] Analyze filename...",self.analyze_name(path)) height,width=orgImg.shape[:2] orgImg = np.reshape(orgImg, (height,width,1)) patches_pred,new_height,new_width,adjustImg=get_test_patches(orgImg,self.config) predictions = self.model.predict(patches_pred, batch_size=32, verbose=1) pred_patches=pred_to_patches(predictions,self.config) pred_imgs=recompone_overlap(pred_patches,self.config,new_height,new_width) pred_imgs=pred_imgs[:,0:height,0:width,:] adjustImg=adjustImg[0,0:height,0:width,:] print(adjustImg.shape) probResult=pred_imgs[0,:,:,0] binaryResult=gray2binary(probResult) resultMerge=visualize([adjustImg,binaryResult],[1,2]) resultMerge=cv2.cvtColor(resultMerge,cv2.COLOR_RGB2BGR) i=i+1 cv2.imwrite(self.config.test_result_path+str(i)+"_merge.jpg",resultMerge) cv2.imwrite(self.config.test_result_path+str(i)+ "_prob.bmp", (probResult255).astype(np.uint8)) — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

看不到你的测试效果

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

xihuanliuliu commented 4 years ago

大佬们,请问这个准确率ACC,F1-score怎么计算啊?他这个TP有255个值,我就不知道该怎么计算了

xihuanliuliu commented 4 years ago

大佬们,请问这个准确率ACC,F1-score怎么计算啊?他这个TP有255个值,我就不知道该怎么计算了

manvirvirk commented 4 years ago

how to train model without using pre trained model?