Britefury / django-labeller

An image labelling tool for creating segmentation data sets, for Django and Flask.
MIT License
140 stars 40 forks source link

Error 500 with DEXTR #19

Open Eliot-RUIZ opened 1 year ago

Eliot-RUIZ commented 1 year ago

Hi,

Your tool seems really useful but I have a problem when trying to using DEXTR.

I followed your installation guide and installed everything needed in a virtual environment (venv_django).

When I run the following code, it says everything is well installed: pip install django-labeller[django] pip install django-labeller[dextr]

However, when I launch either the Flask app or the Django app, everything works except DEXTR. I can indicate the four points when clicking on AutoP, but the box is never converted to a bounding polygon, even for the testing images as in your animated GIF.

I get the following error message in my terminal:

127.0.0.1 - - [03/Jan/2023 20:53:45] "POST /labeller/dextr HTTP/1.1" 500 - Traceback (most recent call last): File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 2548, in __call__ return self.wsgi_app(environ, start_response) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 2528, in wsgi_app response = self.handle_exception(e) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 2525, in wsgi_app response = self.full_dispatch_request() File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/Flask-2.2.2-py3.8.egg/flask/app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/django_labeller-0.3.2-py3.8.egg/image_labelling_tool/flask_labeller.py", line 176, in dextr regions_js = apply_dextr_js(image, dextr_points) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/django_labeller-0.3.2-py3.8.egg/image_labelling_tool/flask_labeller.py", line 63, in apply_dextr_js mask = dextr_fn(image_for_dextr, dextr_points) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/django_labeller-0.3.2-py3.8.egg/image_labelling_tool/flask_labeller.py", line 415, in <lambda> dextr_fn = lambda image, points: dextr_model.predict([image], points[None, :, :])[0] >= 0.5 File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/dextr/model.py", line 119, in predict pred_logits = self.net(input)['out'] File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/dextr/architectures/resunet.py", line 101, in forward x = self.decoder3(x, r16) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/dextr/architectures/resunet.py", line 53, in forward x_up = self.up(x_in) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 157, in forward recompute_scale_factor=self.recompute_scale_factor) File "/home/eliotruiz/venv_django/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1269, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

Thanks in advance for helping me solving this issue so I can use your tool for my researches.

Best, Eliot