Jakel21 / vehicle-ReID-baseline

vehicle re-identification baseline for veri and vehicleID dataset
139 stars 44 forks source link

eval_metrics.py #3

Open wujunyi627 opened 5 years ago

wujunyi627 commented 5 years ago

eval_metrics.py line 74 if numg_g < max_rank:

TypeError: '<' not supported between instances of 'int' and 'list'

liviclee commented 5 years ago

eval_metrics.py, line 119, in eval_veri all_cmc = np.asarray(all_cmc).astype(np.float32) ValueError: setting an array element with a sequence.

Jakel21 commented 5 years ago

eval_metrics.py, line 119, in eval_veri all_cmc = np.asarray(all_cmc).astype(np.float32) ValueError: setting an array element with a sequence.

it seems that your input does not have the same shape so you got this error. Did you test on veri dataset? I could evaluate the dataset without this bug. Maybe the solution is to check and fix your input data. Each row must be the same length. Another possible cause for this error message is trying to use a string as an element in an array of type float. Or maybe can i have a review of your command line so i can understand better that why you got this error?

Jakel21 commented 5 years ago

eval_metrics.py line 74 if numg_g < max_rank:

TypeError: '<' not supported between instances of 'int' and 'list'

I think the error explained clearly and maybe you can print and check the param beside the '<' Or maybe can i have a review of your command line so i can understand better that why you got this error?

Jakel21 commented 5 years ago

I am busy these days but I will still pay attention to this issues. Please let me know if you could solve this issue.

wujunyi627 commented 5 years ago

eval_metrics.py line 74 if numg_g < max_rank: TypeError: '<' not supported between instances of 'int' and 'list'

I think the error explained clearly and maybe you can print and check the param beside the '<' Or maybe can i have a review of your command line so i can understand better that why you got this error?

-s veri -t veri --height 128 --width 256 --optim amsgrad --lr 0.0003 --max-epoch 60 --stepsize 20 40 --train-batch-size 32 --test-batch-size 32 -a resnet50 --save-dir model/resnet50-veri --gpu-devices 0

liviclee commented 5 years ago

eval_metrics.py, line 119, in eval_veri all_cmc = np.asarray(all_cmc).astype(np.float32) ValueError: setting an array element with a sequence.

it seems that your input does not have the same shape so you got this error. Did you test on veri dataset? I could evaluate the dataset without this bug. Maybe the solution is to check and fix your input data. Each row must be the same length. Another possible cause for this error message is trying to use a string as an element in an array of type float. Or maybe can i have a review of your command line so i can understand better that why you got this error?

My command line is:

python train_xent_tri.py --root /data1/jiavili/Dataset/VeRI-776/ -s veri -t veri --height 128 --width 256 --optim amsgrad --lr 0.0003 --max-epoch 60 --stepsize 20 40 --train-batch-size 64 --test-batch-size 100 -a resnet50 --save_dir log/resnet50-veri --gpu-devices 2 

The download VeRi folder is under the VeRI-776 folder.

and I agree with that it is caused by the input data shape. After checking the code, I guess the shape difference might be caused by the operation of "# remove gallery samples that have the same pid and camid with query" in the line 91 of eval_metrics.py. Happy to cooperate and let's solve this problem.

Jakel21 commented 5 years ago

eval_metrics.py, line 119, in eval_veri all_cmc = np.asarray(all_cmc).astype(np.float32) ValueError: setting an array element with a sequence.

it seems that your input does not have the same shape so you got this error. Did you test on veri dataset? I could evaluate the dataset without this bug. Maybe the solution is to check and fix your input data. Each row must be the same length. Another possible cause for this error message is trying to use a string as an element in an array of type float. Or maybe can i have a review of your command line so i can understand better that why you got this error?

My command line is:

python train_xent_tri.py --root /data1/jiavili/Dataset/VeRI-776/ -s veri -t veri --height 128 --width 256 --optim amsgrad --lr 0.0003 --max-epoch 60 --stepsize 20 40 --train-batch-size 64 --test-batch-size 100 -a resnet50 --save_dir log/resnet50-veri --gpu-devices 2 

The download VeRi folder is under the VeRI-776 folder.

and I agree with that it is caused by the input data shape. After checking the code, I guess the shape difference might be caused by the operation of "# remove gallery samples that have the same pid and camid with query" in the line 91 of eval_metrics.py. Happy to cooperate and let's solve this problem.

i check the code and i am sorry that the problem is caused by passing 'args.target_names' in line 250 in train_xent_htri.py to 'max_rank' in evaluate function in vehiclereid/eval_metric.py...... i have change the code so the evaluation process will be ok.

Jakel21 commented 5 years ago

eval_metrics.py line 74 if numg_g < max_rank: TypeError: '<' not supported between instances of 'int' and 'list'

I think the error explained clearly and maybe you can print and check the param beside the '<' Or maybe can i have a review of your command line so i can understand better that why you got this error?

-s veri -t veri --height 128 --width 256 --optim amsgrad --lr 0.0003 --max-epoch 60 --stepsize 20 40 --train-batch-size 32 --test-batch-size 32 -a resnet50 --save-dir model/resnet50-veri --gpu-devices 0

i check the code and i am sorry that the problem is caused by passing 'args.target_names' in line 250 in train_xent_htri.py to 'max_rank' in evaluate function in vehiclereid/eval_metric.py...... i have change the code so the evaluation process will be ok.

hqulxw123 commented 5 years ago

You are so great, thank you for sharing! When I trained veri, the mAP was only 1.1%. When testing it, the mAP was only 8.1%, as shown below. And when I tested the VehicleID, the following problem occurred: result1 result2

hqulxw123 commented 5 years ago

eval_metrics.py line 74 if numg_g < max_rank: TypeError: '<' not supported between instances of 'int' and 'list'

I think the error explained clearly and maybe you can print and check the param beside the '<' Or maybe can i have a review of your command line so i can understand better that why you got this error?

-s veri -t veri --height 128 --width 256 --optim amsgrad --lr 0.0003 --max-epoch 60 --stepsize 20 40 --train-batch-size 32 --test-batch-size 32 -a resnet50 --save-dir model/resnet50-veri --gpu-devices 0

Do you have the next test, I found that my results are slightly lower

Jakel21 commented 5 years ago

You are so great, thank you for sharing! When I trained veri, the mAP was only 1.1%. When testing it, the mAP was only 8.1%, as shown below. And when I tested the VehicleID, the following problem occurred: result1 result2 that's strange,i tested on veri a few days ago and the result:

屏幕快照 2019-08-14 上午10 32 48

This code is the simple baseline and many place still need to improve. I move the test arg in train_xent_htri.py to solve the evaluate problem. if you want to test on vehicleID dataset, change the return function from eval_veri to eval_vehicleid at the last line in eval_metric.py. i will solve the problem later to automatically switch the eval function. This should be easy that you can also do it by yourself.

Jakel21 commented 5 years ago

You are so great, thank you for sharing! When I trained veri, the mAP was only 1.1%. When testing it, the mAP was only 8.1%, as shown below. And when I tested the VehicleID, the following problem occurred: result1 result2

i removed the args.target_names to test what was wrong in eval_metric.py and you can put it back and use it to switch your eval target function in last part in eval_metric.py.

hqulxw123 commented 5 years ago

You are so great, thank you for sharing! When I trained veri, the mAP was only 1.1%. When testing it, the mAP was only 8.1%, as shown below. And when I tested the VehicleID, the following problem occurred: result1 result2

i removed the args.target_names to test what was wrong in eval_metric.py and you can put it back and use it to switch your eval target function in last part in eval_metric.py.

Thank you very much for your reply, I have successfully solved my problem.

z823451255 commented 4 years ago

您真棒,谢谢您的分享! 当我训练Veri时,mAP仅为1.1%。测试时,mAP仅为8.1%,如下所示。当我测试VehicleID时,发生了以下问题: 结果1 结果2

我删除了args.target_names来测试eval_metric.py中出了什么问题,您可以放回去并用它来切换eval_metric.py中的eval目标函数。

非常感谢您的答复,我已经成功解决了我的问题。

How did the modification succeed, please tell me the answer, thank you