comic / evalutils

evalutils helps users create extensions for grand-challenge.org

Home Page:https://grand-challenge.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wired permission denied error

JunMa11 opened this issue · comments

commented
  • evalutils version:0.3.1
  • Python version:3.9
  • Operating System:ubuntu20.04

Description

I create a tif loader and it works for most of the tif images, but I got wired permission denied error for one image.

class TIFIOLoader(ImageIOLoader):
    @staticmethod
    def load_image(fname):
        img_data = tif.imread(fname)
        return img_data

    @staticmethod
    def hash_image(image):
        return hash(image.tobytes())
Sending build context to Docker daemon    147MB
Step 1/12 : FROM python:3.9-slim
 ---> 606eea5f22d7
Step 2/12 : RUN groupadd -r evaluator && useradd -m --no-log-init -r -g evaluator evaluator
 ---> Using cache
 ---> 9d2821550699
Step 3/12 : RUN mkdir -p /opt/evaluation /input /output     && chown evaluator:evaluator /opt/evaluation /input /output
 ---> Using cache
 ---> bca4b8c64370
Step 4/12 : USER evaluator
 ---> Using cache
 ---> cf9a56c79fdd
Step 5/12 : WORKDIR /opt/evaluation
 ---> Using cache
 ---> 8d501fea5475
Step 6/12 : ENV PATH="/home/evaluator/.local/bin:${PATH}"
 ---> Using cache
 ---> 7f9eaa4beec5
Step 7/12 : RUN python -m pip install --user -U pip
 ---> Using cache
 ---> 9e7d4387f8c5
Step 8/12 : COPY --chown=evaluator:evaluator ground-truth /opt/evaluation/ground-truth
 ---> Using cache
 ---> ed4efcc02b72
Step 9/12 : COPY --chown=evaluator:evaluator requirements.txt /opt/evaluation/
 ---> Using cache
 ---> 5d729f79a5a6
Step 10/12 : RUN python -m pip install --user -rrequirements.txt
 ---> Using cache
 ---> a447aa726148
Step 11/12 : COPY --chown=evaluator:evaluator evaluation.py /opt/evaluation/
 ---> 267f1c95d59a
Step 12/12 : ENTRYPOINT "python" "-m" "evaluation"
 ---> Running in 0d9d698f13d6
Removing intermediate container 0d9d698f13d6
 ---> 6ec0b08b1779
Successfully built 6ec0b08b1779
Successfully tagged cellseg22:latest
1+0 records in
1+0 records out
32 bytes copied, 5.9902e-05 s, 534 kB/s
cellseg22-output-a6d6505ec8b35a9f2b15dae2c1edd00d
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/evaluation/evaluation.py", line 186, in <module>
    Cellseg22().evaluate()
  File "/home/evaluator/.local/lib/python3.9/site-packages/evalutils/evalutils.py", line 412, in evaluate
    self.load()
  File "/home/evaluator/.local/lib/python3.9/site-packages/evalutils/evalutils.py", line 423, in load
    self._predictions_cases = self._load_cases(
  File "/home/evaluator/.local/lib/python3.9/site-packages/evalutils/evalutils.py", line 432, in _load_cases
    new_cases = self._file_loader.load(fname=f)
  File "/home/evaluator/.local/lib/python3.9/site-packages/evalutils/io.py", line 95, in load
    img = self.load_image(fname)
  File "/opt/evaluation/evaluation.py", line 16, in load_image
    img_data = tif.imread(fname)
  File "/home/evaluator/.local/lib/python3.9/site-packages/tifffile/tifffile.py", line 973, in imread
    with TiffFile(
  File "/home/evaluator/.local/lib/python3.9/site-packages/tifffile/tifffile.py", line 3598, in __init__
    fh = FileHandle(file, mode=mode, name=name, offset=offset, size=size)
  File "/home/evaluator/.local/lib/python3.9/site-packages/tifffile/tifffile.py", line 11829, in __init__
    self.open()
  File "/home/evaluator/.local/lib/python3.9/site-packages/tifffile/tifffile.py", line 11848, in open
    self._fh = open(self._file, self._mode)  # type: ignore
PermissionError: [Errno 13] Permission denied: '/input/cell_00100_label.tiff'
cat: /output/metrics.json: No such file or directory
Expecting value: line 1 column 1 (char 0)
cellseg22-output-a6d6505ec8b35a9f2b15dae2c1edd00d

What I Did

I test the tifffile locally and it works

Python 3.8.13 (default, Mar 28 2022, 11:38:47) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tifffile as tif
>>> a = tif.imread('./ground-truth/cell_00100_label.tiff')
>>> b = tif.imread('./test/cell_00100_label.tiff')
>>> a.shape
(8415, 10496)
>>> b.shape
(8415, 10496)
>>> import numpy as np
>>> np.max(a)
96234
>>> np.max(b)
96234

Check your file permissions, the docker container does not run as the same user.

commented

Thank you @jmsmkn very much:)