Open WangyiNTU opened 5 years ago
Have you trained the model yourself? I'll upload the pretrained model ASAP.
@leeyeehoo Yes, the final results are improved to 69 MAE, when I use your code without any change. And, I found the data augmentation is disabled in the image.py as follow. It will influence the final results? The previous obtained 73.26 MAE comes from my change (that is, 'if False' is changed to 'if train'). ` if False: crop_size = (img.size[0]/2,img.size[1]/2) if random.randint(0,9)<= -1:
dx = int(random.randint(0,1)*img.size[0]*1./2)
dy = int(random.randint(0,1)*img.size[1]*1./2)
else:
dx = int(random.random()*img.size[0]*1./2)
dy = int(random.random()*img.size[1]*1./2)
img = img.crop((dx,dy,crop_size[0]+dx,crop_size[1]+dy))
target = target[dy:crop_size[1]+dy,dx:crop_size[0]+dx]
if random.random()>0.8:
target = np.fliplr(target)
img = img.transpose(Image.FLIP_LEFT_RIGHT)`
Thanks!
same question, why the data augmentation is disabled?
Because we found out that by using the original image without cropping could reach better results. And by using the same cropping method, the results are slightly better in Caffe (mentioned in paper) than PyTorch (you said 73.26).
OK, I see. Thanks a lot!
I have used val to test partA, but the mae is very high 0 1039.234375 1 3270.0751953125 2 4630.0849609375 3 7451.38427734375 4 13182.578125 5 14520.990844726562 6 20020.381469726562 7 34471.97229003906 8 36625.15148925781 9 41896.54553222656 10 51193.14318847656 11 51800.69665527344 12 52128.655670166016 13 52754.70217895508 14 55443.40872192383 15 56253.32388305664 16 60179.312408447266 17 60813.217376708984 18 63668.902923583984 19 66381.42611694336 20 69399.40219116211 21 71583.58383178711 22 78590.99594116211 23 82238.25765991211 24 83930.38412475586 25 91782.86410522461
@liuleiBUAA In the val.ipynb, you should change it as follow:
# img = 255.0 * F.to_tensor(Image.open(img_paths[i]).convert('RGB'))
# img[0,:,:]=img[0,:,:]-92.8207477031
# img[1,:,:]=img[1,:,:]-95.2757037428
# img[2,:,:]=img[2,:,:]-104.877445883
# img = img.cuda()
img = transform(Image.open(img_paths[i]).convert('RGB')).cuda()
Thank you@ WangyiNTU Have you trained the model? How many epoch have you used to train the model in part A and part B
@liuleiBUAA
python train.py part_A_train.json part_A_test.json 0 0
is OK for me.
run make_dataset.ipynb first.
I train the model, but loss is nan, do you have the same problem Epoch: [0][300/1200] Time 0.415 (0.414) Data 0.018 (0.020) Loss nan (nan)
@liuleiBUAA I didn't have this problem.
@WangyiNTU Thank you for your help, I trained from the start, the loss is nan, I will try to solve this problem
@WangyiNTU I change the model.py in class CSRNet(nn.Module): def init(self, load_weights=False): to class CSRNet(nn.Module): def init(self, load_weights=True): The model can convergence, however, I cannot get the MAE of 68 in partA and 10.6 in partB do you change the code like this?
@liuleiBUAA load_weights=True
doesn't use pretrained VGG and initialize parameters as a Gaussian distribution. I run in load_weights=False
setting and get 69 MAE on Part A.
@WangyiNTU Thank you. Can I see your model.py for part of class CSRnet? and how many epoch have you train the model?
If I set load_weights=False, the loss is very high and will be nan
Have you trained the model yourself? I'll upload the pretrained model ASAP.
Could you tell me where is your pretained model ASAP,I can not find it
Thanks for your Pytorch implementation! I have run the code on the Part_A of ShanghaiTect dataset. In the testing, I can obtain 73.26 MAE for this data. So, how can I reach the 66.4 MAE as mentioned in the readme? Or, this reimplementation is unfinished for now. Thanks!
Could you tell me where is the pretain parameters of CSRnet? Or you get the MAE 73.26 by using your own training parameters?
@jiehaohuang Here, ShanghaiA MAE: 66.4 Google Drive ShanghaiB MAE: 10.6 Google Drive
@WangyiNTU Hi, I use your parameters, and get 66.622 for ShanghaiA, 11.98 for ShanghaiB. Does this is normal error range?
@WangyiNTU Hi, I use your parameters, and get 66.622 for ShanghaiA, 11.98 for ShanghaiB. Does this is normal error range?
The parameters is provided by author. Your results are normal I suppose.
@WangyiNTU Thanks, I see.
@liuleiBUAA
python train.py part_A_train.json part_A_test.json 0 0
is OK for me. run make_dataset.ipynb first.
Hi, I have a question about the path of validation, in your format, could I understand that you regard the test set as the validation set? And there are two json file related to validation set in author's release, I'm confused...
@leeyeehoo I'm facing with a problem when training TRANCOS from scratch, can you provide pretrained model of TRANCOS dataset,
Hi, I have deleted the pretrained model, you can use CSRnet frist
------------------ 原始邮件 ------------------ 发件人: "Nguyễn Thành Nhân"<notifications@github.com>; 发送时间: 2020年3月30日(星期一) 中午1:08 收件人: "leeyeehoo/CSRNet-pytorch"<CSRNet-pytorch@noreply.github.com>; 抄送: "刘雷"<474086736@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [leeyeehoo/CSRNet-pytorch] MAE of Part_A (#8)
@leeyeehoo I'm facing with a problem when training TRANCOS from scratch, can you provide pretrained model of TRANCOS dataset,
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@leeyeehoo @liuleiBUAA can you explain your comment "you can use CSRnet frist", there are 4 metrics to measure (GAME), but I dont know how to concatenate them to have the final result, can you tell me more hint about this ? thanks
@liuleiBUAA
python train.py part_A_train.json part_A_test.json 0 0
is OK for me. run make_dataset.ipynb first.Hi, I have a question about the path of validation, in your format, could I understand that you regard the test set as the validation set? And there are two json file related to validation set in author's release, I'm confused...
Me too~~
@liuleiBUAA In the val.ipynb, you should change it as follow:
# img = 255.0 * F.to_tensor(Image.open(img_paths[i]).convert('RGB')) # img[0,:,:]=img[0,:,:]-92.8207477031 # img[1,:,:]=img[1,:,:]-95.2757037428 # img[2,:,:]=img[2,:,:]-104.877445883 # img = img.cuda() img = transform(Image.open(img_paths[i]).convert('RGB')).cuda()
Thanks
Thanks for your Pytorch implementation! I have run the code on the Part_A of ShanghaiTect dataset. In the testing, I can obtain 73.26 MAE for this data. So, how can I reach the 66.4 MAE as mentioned in the readme? Or, this reimplementation is unfinished for now. Thanks!