tryolabs / luminoth

Deep Learning toolkit for Computer Vision.
https://tryolabs.com
BSD 3-Clause "New" or "Revised" License
2.4k stars 399 forks source link

Image output not working #274

Open koeks opened 5 years ago

koeks commented 5 years ago

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 commented 5 years ago

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,
    ]

`