Closed Tahiya31 closed 4 years ago
you can run pip install -e .
under the root directory.
Thanks, @ruotianluo! That resolved my issue.
But now when I run the command python tools/eval.py --model model.pth --infos_path infos.pkl --image_folder blah --num_images 10
in ImageCaptioning.pytorch
, I get this:
loading annotations into memory...
0:00:00.354726
creating index...
index created!
Traceback (most recent call last):
File "tools/eval.py", line 74, in
Any idea on what caused this? I basically just want to generate captions of some images that I have under blah
using the pretrained model.
add --force --language_eval 0
may solve it.
I added --force 1 --language_eval 0
in the command, and it worked! Thanks a lot!
The only issue is the images are being processed at random order. I have 800+ images named frame0, frame3... and so on. When I run the command to generate captions, the images are processed in this order: frame597, frame 1188...like this.
DataLoaderRaw found 812 images cp "blah/frame597.jpg" vis/imgs/img1.jpg image 1: a man is standing on the side of a building with a clock tower cp "blah/frame1188.jpg" vis/imgs/img2.jpg image 2: a red double decker bus driving down a city street cp "blah/frame1836.jpg" vis/imgs/img3.jpg image 3: a building with a clock tower on top of it cp "blah/frame1605.jpg" vis/imgs/img4.jpg
So I am losing the order of my image in the result.
Is there any way to fix it so that frame0->img1, frame3->img2 ? Thanks again!
You can try add sorting here https://github.com/ruotianluo/ImageCaptioning.pytorch/blob/master/captioning/data/dataloaderraw.py#L79
I added this below the line you pointed:
self.files.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))
And it worked nicely! Thanks a lot for your help!
Hi @ruotianluo,
I am trying to use the pretrained model to perform evaluation on my own images.
when I run the command
python tools/eval.py --model model.pth --infos_path infos.pkl --image_folder blah --num_images 10
, I encounter this error:Warning: coco-caption not available Traceback (most recent call last): File "tools/eval.py", line 19, in
import captioning.modules.losses as losses
ModuleNotFoundError: No module named 'captioning.modules'
I see that captioning has several other modules (models, data, utils) which are being imported fine. But modules are not. Can you please take a look? Thanks!