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

Image output not working #274

Open
koeks opened this issue Apr 1, 2019 · 1 comment
Open

Image output not working #274

koeks opened this issue Apr 1, 2019 · 1 comment

Comments

@koeks
Copy link

koeks commented Apr 1, 2019

So the JSON output works fine but when I use file output to save image it doesn't work

lumi predict t.jpg --checkpoint=fast -f o.json --save-media-to=o
or
lumi predict t.jpg --checkpoint=fast -f o.json -d o.jpg

I get this output

Predicting /var/www/t.jpg...Traceback (most recent call last):
File "/usr/local/bin/lumi", line 11, in
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/luminoth/predict.py", line 279, in predict
save_path=save_path,
File "/usr/local/lib/python2.7/dist-packages/luminoth/predict.py", line 94, in predict_image
vis_objects(np.array(image), objects).save(save_path)
File "/usr/local/lib/python2.7/dist-packages/luminoth/vis.py", line 170, in vis_objects
draw, obj['bbox'], color, width=round(3 * scale), fill=fill
File "/usr/local/lib/python2.7/dist-packages/luminoth/vis.py", line 75, in draw_rectangle
for i in range(width):
TypeError: range() integer end argument expected, got float.

Any ideas?

Thanks

@brockjdb
Copy link

Lines 73 -81, modify to force the value of width to integer.

# Pillow doesn't support width in rectangles, so we must emulate it with a # loop. for i in range(int(width)): coords = [ coordinates[0] - i, coordinates[1] - i, coordinates[2] + i, coordinates[3] + i, ]

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