NeuralBabyTalk icon indicating copy to clipboard operation
NeuralBabyTalk copied to clipboard

Bad result

Open BillLZD opened this issue 5 years ago • 4 comments

excuse me, I get this error when I try demo.py, how can i solve the problem? thanks

tensor(5.7164e+05): wipe alive receiver doing wipe alive payer wipe [ pontoon ] 
tensor(2.9898e+05): wipe [ jetliner ] skating corsage wipe thermos doing wipe [ macbook ] 
.....
tensor(3.6977e+05): wipe straining rubs crotch doing wipe [ ski ] rubs crotch payer wipe [ ski ] rubs standing 
saving...
Traceback (most recent call last):
  File "demo.py", line 255, in <module>
    if opt.att_model == 'topdown':
  File "/opt/conda/lib/python3.6/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/opt/conda/lib/python3.6/json/encoder.py", line 428, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/opt/conda/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/conda/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
    yield from chunks
  File "/opt/conda/lib/python3.6/json/encoder.py", line 437, in _iterencode
    o = _default(o)
  File "/opt/conda/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'Tensor' is not JSON serializable

BillLZD avatar Apr 03 '19 03:04 BillLZD

I have solved it.

add .item() function to the code: entry = {'image_id': img_id[0].item(), 'caption': sents[0]}

BillLZD avatar Apr 03 '19 04:04 BillLZD

The captions are very strange. However,the detection part performs well. Why the demo.py generates captions like this?

ID:184386 sentence: wipe [ bulldog ] doing wipe afraid form payer wipe afraid form 
ID:231037 sentence: wipe [ ship ] undergoing wipe [ baseball bat ] outdoor heating rubs wipe animal 
ID:467437 sentence: wipe [ ship ] serene outdoor wipe [ bulldog ] doing wipe [ ship ] 
ID:258588 sentence: wipe [ ship ] corsage wipe afraid reflected payer cub housed stitch kids 
ID:460251 sentence: wipe [ clock ] converses skating outdoor heating rubs wipe moped tried 
ID:357978 sentence: wipe hull rubs [ bagel ] preparation carved wipe tried 
ID:571641 sentence: wipe alive receiver doing wipe alive payer wipe [ pontoon ] 
ID:163348 sentence: wipe [ schnauzer ] payer wipe [ pontoon ] outdoor wipe receiver 
ID:298978 sentence: wipe [ jetliner ] skating corsage wipe thermos doing wipe [ macbook ] 
ID:258628 sentence: wipe [ ship ] horns stitch kids outdoor wipe western 
ID:118432 sentence: wipe hull rubs [ bagel ] preparation outdoor heating rubs wipe bins bubbles [ cockatoo ] 
ID:205230 sentence: wipe hull rubs [ kids ] skating carved wipe [ cupcake ] 
ID:345136 sentence: wipe civilians [ walker ] skating corsage wipe bins doing wipe prints payer afraid [ cockatoo ] 
ID:404613 sentence: wipe [ kid ] horns sprout wipe [ foal ] corsage wipe bins 
ID:131089 sentence: wipe chalk [ walker ] horns stitch doing wipe ceramics 
ID:432570 sentence: wipe [ biker ] doing who corsage reception skating outdoor wipe tried 
ID:214224 sentence: wipe [ jetliner ] horns preparation session wipe southeast doing wipe envelopes rubs [ skateboarded ] 
ID:199764 sentence: wipe hull rubs [ bagel ] preparation carved wipe tried doing wipe rugs 
ID:176312 sentence: wipe [ jetliner ] preparation corsage dandelion rubs wipe served sprout wipe [ firetruck ] 
ID:453297 sentence: wipe [ firetruck ] horns skating outdoor wipe tried bathtub useful wipe terminal 
ID:529668 sentence: wipe [ jetliner ] sprout wipe [ firetruck ] corsage dandelion rubs wipe rugs 
ID:551107 sentence: wipe civilians [ traffic light ] preparation corsage dandelion rubs wipe [ macbook ] 
ID:413120 sentence: wipe inspired [ biker ] fun doing prints removing uneaten 
ID:369771 sentence: wipe straining rubs crotch doing wipe [ ski ] rubs crotch payer wipe [ ski ] rubs standing 

BillLZD avatar Apr 03 '19 04:04 BillLZD

I also have very similar result, the result is very bad. what does wipe mean here? it seems there are so many wipe appearing

junchen14 avatar Mar 17 '20 12:03 junchen14

I think the pre-trained weight is not right. When I use the pre-trained model for evaluation, the BLEU4 and Cider is so bad. But After training my model without pre-trained weights which they provided, the result is good.

HeartFu avatar Jul 06 '20 09:07 HeartFu