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

Error when uploading a completed annotation to db #1

Open
okunator opened this issue Jan 15, 2021 · 23 comments
Open

Error when uploading a completed annotation to db #1

okunator opened this issue Jan 15, 2021 · 23 comments
Labels
bug Something isn't working

Comments

@okunator
Copy link

Hi,

The following error occurs when I try to upload a completed annotation: Canvas upload response: [400] {"error":"Non [0,255] incorrect values are saved in the roimask mask, please check"}. So far I've followed the User Manual step by step.

@Rexmiao
Copy link
Collaborator

Rexmiao commented Jan 16, 2021

Thanks for commenting.
What is the size of the image slides that you uploaded and the crop size? If the crop size is larger than the actual image size (e.g., the image size is 1000x1000, and the crop size is 1024x1024), the QA will try to save a 1024 x 1024 ROI mask for a 1000x1000 image, which would give this error message.

@okunator
Copy link
Author

I uploaded 1000x1000 images and the crop size was 256x256 when I worked on the annotations. Could it be that the annotator assigns a negative or nan value for the background class instead of zeros?

@Rexmiao Rexmiao added the bug Something isn't working label Jan 19, 2021
@choosehappy
Copy link
Owner

Can you send a screenshot of the ROI you're trying to upload?

After clicking upload, the remaining points should be filled with appropriate 255 values, so at this stage every point has a value:

image

@ValeAri
Copy link

ValeAri commented Jan 21, 2021

Hello,

I have exactly the same problem too. Could be related to the fact that I am using a virtual environment with Python 3.6 and not 3.8?
Thank you in advance!

@Rexmiao
Copy link
Collaborator

Rexmiao commented Jan 21, 2021

@ValeAri Can you upload an image file that you are using here? It would be very helpful if you could send a screenshot of where you were annotating or make a simple description about where you have been trying to annotate when you were making annotation.

@okunator
Copy link
Author

okunator commented Jan 22, 2021

Sorry for the delay. Here is a screenshot. After clicking the 'Training' or 'Testing' button the same error occurs. Switching to 'Fill with unknown' or turning off the superpixels does not make a difference.

dd

@choosehappy
Copy link
Owner

choosehappy commented Jan 22, 2021 via email

@okunator
Copy link
Author

I'm running in linux ubuntu 18.04.1 system. Python version is 3.6.9.

Here is the 'pip freeze' of the virtual environment I created for QuickAnnotator:

albumentations==0.4.3
argon2-cffi==20.1.0
astroid==2.4.2
async-generator==1.10
attrs==20.3.0
backcall==0.2.0
bleach==3.2.1
certifi==2020.12.5
cffi==1.14.4
chardet==3.0.4
click==7.1.2
config==0.4.2
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
Flask==1.0.3
Flask-Restless==0.17.0
Flask-SQLAlchemy==2.4.0
future==0.18.2
histolab==0.2.1
idna==2.8
imageio==2.9.0
imgaug==0.2.6
importlib-metadata==3.4.0
ipykernel==5.4.3
ipython==7.16.1
ipython-genutils==0.2.0
isort==5.7.0
itsdangerous==1.1.0
jedi==0.18.0
Jinja2==2.11.2
joblib==1.0.0
jsonschema==3.2.0
jupyter-client==6.1.11
jupyter-core==4.7.0
jupyterlab-pygments==0.1.2
kiwisolver==1.3.1
lazy-object-proxy==1.4.3
llvmlite==0.35.0
MarkupSafe==1.1.1
matplotlib==3.3.3
mccabe==0.6.1
mimerender==0.6.0
mistune==0.8.4
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.1.0
nest-asyncio==1.4.3
networkx==2.5
notebook==6.2.0
numba==0.52.0
numpy==1.19.4
opencv-python==4.5.1.48
opencv-python-headless==4.1.1.26
openslide-python==1.1.2
packaging==20.8
pandocfilters==1.4.3
parso==0.8.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==6.2.0
pkg-resources==0.0.0
prometheus-client==0.9.0
prompt-toolkit==3.0.10
protobuf==3.14.0
ptyprocess==0.7.0
pycparser==2.20
Pygments==2.7.4
pylint==2.6.0
pyparsing==2.4.7
pyrsistent==0.17.3
python-dateutil==2.8.1
python-mimeparse==1.6.0
PyWavelets==1.1.1
PyYAML==5.3.1
pyzmq==21.0.0
requests==2.22.0
scikit-image==0.17.2
scikit-learn==0.21.3
scipy==1.5.4
Send2Trash==1.5.0
six==1.15.0
SQLAlchemy==1.3.5
tensorboardX==1.9
terminado==0.9.2
testpath==0.4.4
tifffile==2020.9.3
toml==0.10.2
torch==1.5.0
torchvision==0.6.0
tornado==6.1
tqdm==4.56.0
traitlets==4.3.3
ttach==0.0.2
typed-ast==1.4.2
typing-extensions==3.7.4.3
umap-learn==0.3.10
urllib3==1.25.11
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==1.0.1
wrapt==1.12.1
zipp==3.4.0

@okunator
Copy link
Author

Also, I did not use the patching script that was provided for the initial patching of wsi files. I had patched the wsi images beforehand to .png files.

@choosehappy
Copy link
Owner

choosehappy commented Jan 22, 2021 via email

@ValeAri
Copy link

ValeAri commented Jan 22, 2021

Hello!
Sorry for the delay, I did the same thing as okunator. I am running the code in a linux ubuntu 18.04.1 system and I created a virtual machine with Python 3.6. Using pip3 freeze I have the following information:
albumentations==0.4.3
certifi==2020.12.5
chardet==3.0.4
click==7.1.2
config==0.4.2
cycler==0.10.0
decorator==4.4.2
Flask==1.0.3
Flask-Restless==0.17.0
Flask-SQLAlchemy==2.4.0
future==0.18.2
idna==2.8
imageio==2.9.0
imgaug==0.2.6
itsdangerous==1.1.0
Jinja2==2.11.2
joblib==1.0.0
kiwisolver==1.3.1
llvmlite==0.35.0
MarkupSafe==1.1.1
matplotlib==3.3.3
mimerender==0.6.0
networkx==2.5
numba==0.52.0
numpy==1.16.4
opencv-python-headless==4.1.1.26
Pillow==6.2.0
protobuf==3.14.0
pyparsing==2.4.7
python-dateutil==2.8.1
python-mimeparse==1.6.0
PyWavelets==1.1.1
PyYAML==5.4.1
requests==2.22.0
scikit-image==0.15.0
scikit-learn==0.21.3
scipy==1.3.0
six==1.15.0
SQLAlchemy==1.3.5
tensorboardX==1.9
torch==1.5.0
torchvision==0.6.0
ttach==0.0.2
umap-learn==0.3.10
urllib3==1.25.11
Werkzeug==1.0.1

I attached a screen of the error and the image. How you could see I did some annotation with the "flood fill" and I did not receive any error. But when I try to select just some areas with the pencil I obtain it.
Err

@okunator
Copy link
Author

I'm not too comfortable on sending the .png files. However, I tried to reproduce the error with the Kumar dataset (monuseg) and Consep dataset (hover-net) downloaded from their corresponding websites and the same error occurs. Here is a screenshot of an image from kumar dataset:
k'

@choosehappy
Copy link
Owner

I just cloned and tried an image from the hovernet dataset:

image

and it worked without issue, so it seems like an environmental difference

Can you try the docker version?

@ValeAri
Copy link

ValeAri commented Jan 25, 2021

Hi,
Sorry for the delay. I installed the docker version and I tried an image from the Kumar dataset. Unfortunately, I have still the same problem. I attached both the image of the terminal and that one of the program.

T1
T2

Thank you in advance!

@choosehappy
Copy link
Owner

@ValeAri since this looks like a TCGA image, and is in the public domain, can you upload exactly the png you're using here?

@ValeAri
Copy link

ValeAri commented Jan 25, 2021

Hello, I used this image from Kumar dataset:
TCGA-HE-7130-01Z-00-DX1

@Rexmiao
Copy link
Collaborator

Rexmiao commented Jan 25, 2021

@ValeAri Hi, I just downloaded your image and tried it on my desktop. It works fines for me.
image

I attached the package I have here. I am using Python 3.8 System Interpreter on PyCharm.

Flask 1.1.2 1.1.2
Flask-Restless 0.17.0 0.17.0
Flask-SQLAlchemy 2.4.4 2.4.4
Jinja2 2.11.2 2.11.2
MarkupSafe 1.1.1 1.1.1
Pillow 8.1.0 8.1.0
PyWavelets 1.1.1 1.1.1
PyYAML 5.4.1 5.4.1
SQLAlchemy 1.3.22 1.3.22
Werkzeug 1.0.1 1.0.1
albumentations 0.4.3 0.5.2
certifi 2020.12.5 2020.12.5
chardet 4.0.0 4.0.0
click 7.1.2 7.1.2
config 0.4.2 0.5.0.post0
cycler 0.10.0 0.10.0
decorator 4.4.2 4.4.2
idna 2.10 3.1
imageio 2.9.0 2.9.0
imgaug 0.2.6 0.4.0
itsdangerous 1.1.0 1.1.0
joblib 1.0.0 1.0.0
kiwisolver 1.3.1 1.3.1
llvmlite 0.35.0 0.35.0
matplotlib 3.3.3 3.3.3
mimerender 0.6.0 0.6.0
networkx 2.5 2.5
numba 0.52.0 0.52.0
numpy 1.17.3 1.19.5
opencv-contrib-python-headless 4.5.1.48 4.5.1.48
opencv-python-headless 4.5.1.48 4.5.1.48
pip 21.0 21.0
protobuf 3.14.0 3.14.0
pyparsing 2.4.7 2.4.7
python-dateutil 2.8.1 2.8.1
python-mimeparse 1.6.0 1.6.0
requests 2.25.1 2.25.1
scikit-image 0.18.1 0.18.1
scikit-learn 0.24.0 0.24.1
scipy 1.6.0 1.6.0
setuptools 52.0.0 52.0.0
six 1.15.0 1.15.0
tensorboardX 1.9 2.1
threadpoolctl 2.1.0 2.1.0
tifffile 2021.1.14 2021.1.14
torch 1.7.1+cu110 1.7.1
torchaudio 0.7.2 0.7.2
torchvision 0.8.2+cu110 0.8.2
ttach 0.0.2 0.0.3
typing-extensions 3.7.4.3 3.7.4.3
umap-learn 0.3.10 0.5.0
urllib3 1.26.2 1.26.2

@ValeAri
Copy link

ValeAri commented Feb 1, 2021

Hello! Sorry for the delay. Unfortunately, I did not resolve the problem. I checked the packages installed on the Docker and they are equal to yours except for pip (version 20.0.2 instead of 21) and setuptools (version 45.2.0 instead of 52.0.0) and I do not use Pycharm. Honestly, I am sure that these can not change so drastically the working of the code, but I reported it to you for give you a complete idea of my setup.

Thank you in advance!

@choosehappy
Copy link
Owner

that is extremely strange, can you describe what operating system + web browser (and version) you're using?

@ValeAri
Copy link

ValeAri commented Feb 1, 2021

I run the code in a Ubuntu 18.04 system and I use Firefox version 85.0 (64-bit) as web browser.

@choosehappy
Copy link
Owner

choosehappy commented Feb 1, 2021 via email

@Rexmiao
Copy link
Collaborator

Rexmiao commented Feb 2, 2021

@ValeAri Thanks for the information.
I managed to reproduce the error on Firefox Browser. I think this is caused by the Firework is not working well with JQuery. There are actually quite a bit of complaints online about this. (e.g., https://wordpress.stackexchange.com/questions/194385/ajax-not-firing-properly-using-firefox-but-works-in-chrome)

I think this error is ruled out in Chrome Browser. If you want to quickly test data with QA, I think you could just switch to Chome to rule out this error.

Here is what I found the possible cause of this issue.
First, I put a breakpoint at line 230 at annotation-tool.js to overwatch the mask_data variable. As you can see in the screenshot, there are some 127 values in the mask_data. These are where the non {0,255} values come from. However, these 127 values are not the actually values we are attempting to parse. These 127 represents the alpha color channel. When you are annotating with the freehand tool and superpixel tool, those annotations are semi-transparent (alpha channel=127)
image
This is the value that we want to parse to the backend. All the alpha channel is set to 255 (meaning nontransparent). When the user clicks the "upload" button, it pops up a dialog box, which employs JQuery. With users clicking on the "upload" buttons, a dialog box pops up and the QA would know that these semi-transparent annotations would be changed to solid color since they are going to be stored as image masks. However, since Firefox does not work well with JQuery, the semi-transparent mask was parsed to the backend, and the backend checks for {0,255} and reported an error.
image
I hope this helps for now. At the same time, I will look into this issue.

@ValeAri
Copy link

ValeAri commented Feb 2, 2021

Hello!
I tried QA with chrome and it works perfectly fine! I am sorry that I did not think about browser issues...and a possible conflict with JQuery.

Anyway thank you very much for your help! I will continue using chrome browser for my analysis then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants