fidler-lab / polyrnn-pp-pytorch

PyTorch training/tool code for Polygon-RNN++ (CVPR 2018)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: operands could not be broadcast together with shapes (256,256) (512,512)

Jacoobr opened this issue · comments

Hi, @amlankar , when i try to train RL model on my own dataset which include prostate MRI with different image size 512x512 and 320x320 , then i got the Value Error as bellow:

Exception NameError: "global name 'FileNotFoundError' is not defined" in <bound method _DataLoaderIter.__del__ of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f5964cd7c90>> ignored
Traceback (most recent call last):
  File "/home/tzq-lxj/workStation/polygonRNN_pluss/code/Scripts/train/train_rl.py", line 304, in <module>
    trainer.loop()
  File "/home/tzq-lxj/workStation/polygonRNN_pluss/code/Scripts/train/train_rl.py", line 119, in loop
    self.train(epoch)
  File "/home/tzq-lxj/workStation/polygonRNN_pluss/code/Scripts/train/train_rl.py", line 179, in train
    sampling_ious[i] = metrics.iou_from_mask(sampling_masks[i], gt_mask)
  File "/home/tzq-lxj/workStation/polygonRNN_pluss/code/Evaluation/metrics.py", line 72, in iou_from_mask
    false_negatives = np.count_nonzero(np.logical_and(gt, np.logical_not(pred)))
ValueError: operands could not be broadcast together with shapes (256,256) (512,512) 

So, dose the error means the train images that input to the RL network must be the same size?
How can i handle the problem by changing the RL code without changing the image size when the training dataset with different image size or i get something wrong ?

Sorry to bother you! I have sorved the problem by changing the code of train_rl.py script.^_^

ezoic increase your site revenue