choosehappy / QuickAnnotator

An open-source digital pathology based rapid image annotation tool
BSD 3-Clause Clear License
74 stars 27 forks source link

Error when uploading a completed annotation to db #1

Open okunator opened 3 years ago

okunator commented 3 years ago

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

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

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?

choosehappy commented 3 years ago

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

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

@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 commented 3 years ago

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

thank you, screenshot looks okay

can you describe the environment you're running in? windows/linux, python version

additionally the output from running:

pip3 freeze

would be helpful

note to self, email responses do not support markdown

On Fri, Jan 22, 2021 at 9:14 AM Okunator notifications@github.com wrote:

Sorry for the delay. Here is a screenshot. After clicking the 'Training' or 'Testing' button the same error occurs.

[image: dd] https://user-images.githubusercontent.com/32158343/105464471-52df0a80-5c9a-11eb-8b69-334b51e67a0d.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/choosehappy/QuickAnnotator/issues/1#issuecomment-765224081, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJ3XTE6OGJSVZNGBZYQ7CTS3EXXNANCNFSM4WD3VALA .

okunator commented 3 years ago

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

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

these all seem reasonable

is it possible to provide the PNG which is causing the error?

On Fri, Jan 22, 2021 at 9:40 AM Okunator notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/choosehappy/QuickAnnotator/issues/1#issuecomment-765238586, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJ3XTHLAEUGZFDH43N73D3S3E2YDANCNFSM4WD3VALA .

ValeAri commented 3 years ago

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

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

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

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

@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 commented 3 years ago

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

Rexmiao commented 3 years ago

@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 commented 3 years ago

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

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

ValeAri commented 3 years ago

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

choosehappy commented 3 years ago

interesting, i haven't tested it on a firefox, do you have a chrome browser you can try it on, just to rule that out? thanks

On Tue, Feb 2, 2021 at 12:20 AM Valeria notifications@github.com wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/choosehappy/QuickAnnotator/issues/1#issuecomment-771229477, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJ3XTFAQYJGU3V2WN5CWDLS44ZM3ANCNFSM4WD3VALA .

Rexmiao commented 3 years ago

@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 _maskdata 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 commented 3 years ago

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.