kywen1119 / DSRAN

Code for journal paper "Learning Dual Semantic Relations with Graph Attention for Image-Text Matching", TCSVT, 2020.
Apache License 2.0
71 stars 12 forks source link

ZeroDivisionError: float division by zero #5

Open zencyyoung opened 3 years ago

zencyyoung commented 3 years ago

Computing results... Test: [0/40] Le 62.6173 (62.6172) Time 21.456 (0.000) Test: [10/40] Le 60.1161 (61.4845) Time 0.555 (0.000) Test: [20/40] Le 60.0993 (61.2988) Time 0.562 (0.000) Test: [30/40] Le 63.2631 (61.8778) Time 0.469 (0.000) encode_time:43.724445 5k--------------- torch.Size([1000, 1024]) Images: 1000, Captions: 5000 imgs: 1000, caps: 5000 i2t:r1: 76.1, r5: 93.2, r10: 97.0 t2i:r1: 57.5, r5: 84.4, r10: 91.0 rsum=499.2 sims_time:1.139145 1k--------------- 0 Images: 200, Captions: 1000 imgs: 200, caps: 1000 i2t:r1: 90.5, r5: 97.5, r10: 98.5 t2i:r1: 76.2, r5: 95.7, r10: 98.2 rsum=556.6

1 Images: 0, Captions: 0 imgs: 0, caps: 0 Traceback (most recent call last): File "evaluation_bert.py", line 351, in main() File "evaluation_bert.py", line 348, in main evalrank(opt.model + '/' + opt.name + ".pth.tar", data_path = opt.data_path, split="test", fold5=opt.fold, region_bbox_file=opt.region_bbox_file, feature_path=opt.feature_path) File "evaluation_bert.py", line 201, in evalrank r = simrank(sims) File "evaluation_bert.py", line 304, in simrank r1 = 100.0 * len(numpy.where(ranks < 1)[0]) / len(ranks) ZeroDivisionError: float division by zero

———————————————————————————————— I've noticed Images: 0, Captions: 0 imgs: 0, caps: 0

What could let this happen ?

kywen1119 commented 3 years ago

Sorry about an error in previous sh code when evaluating on Flickr30K. I have modified them in the current version by removing "--fold" . You can try the code now: python evaluation.py --model GRU/f_model1 --data_path "$DATA_PATH" --region_bbox_file "$REGION_BBOX_FILE" --feature_path "$FEATURE_PATH"

zencyyoung commented 3 years ago

works well, thanks