Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: float division by zero #5

Open
zencyyoung opened this issue Dec 14, 2020 · 2 comments
Open

ZeroDivisionError: float division by zero #5

zencyyoung opened this issue Dec 14, 2020 · 2 comments

Comments

@zencyyoung
Copy link

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
Copy link
Owner

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
Copy link
Author

works well, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants