Skip to content

[BUG]: File not found when running examples #79

Open
@andieich

Description

@andieich

Description

I am trying to run the examples_detection_segmentation.ipynb notebook.
First, for some reason, the example images were not downloaded, and the directory to which ROOT_RESOURCES_EXAMPLES refers is empty. I manually downloaded the images and changed the ROOT_RESOURCES_EXAMPLES variable to refer to the downloaded photos.
Now to my actual problem. An error occurs, however, when I do the "detection" step:

SWATCHES = []
for image in COLOUR_CHECKER_IMAGES:
	for colour_checker_data in detect_colour_checkers_inference(
    	image, additional_data=True):
   	 
    	swatch_colours, swatch_masks, colour_checker_image = (
        	colour_checker_data.values)
    	SWATCHES.append(swatch_colours)
   	 
    	# Using the additional data to plot the colour checker and masks.
    	masks_i = np.zeros(colour_checker_image.shape)
    	for i, mask in enumerate(swatch_masks):
        	masks_i[mask[0]:mask[1], mask[2]:mask[3], ...] = 1
   	 
    	colour.plotting.plot_image(
        	colour.cctf_encoding(
            	np.clip(colour_checker_image + masks_i * 0.25, 0, 1)));

Apparently, the results file in a temporary directory is not found:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[10], line 3
      1 SWATCHES = []
      2 for image in COLOUR_CHECKER_IMAGES:
----> 3     for colour_checker_data in detect_colour_checkers_inference(
      4        image, additional_data=True):
      6         swatch_colours, swatch_masks, colour_checker_image = (
      7             colour_checker_data.values)
      8         SWATCHES.append(swatch_colours)

File[ ~\miniconda3\Lib\site-packages\colour_checker_detection\detection\inference.py:367](http://localhost:8888/lab/tree/Andi/pigmentation/code/~/miniconda3/Lib/site-packages/colour_checker_detection/detection/inference.py#line=366), in detect_colour_checkers_inference(image, samples, cctf_decoding, apply_cctf_decoding, inferencer, inferencer_kwargs, show, additional_data, **kwargs)
    364 working_width = settings.working_width
    365 working_height = settings.working_height
--> 367 results = inferencer(image, **inferencer_kwargs)
    369 if is_string(image):
    370     image = read_image(cast(str, image))

File[ ~\miniconda3\Lib\site-packages\colour_checker_detection\detection\inference.py:218](http://localhost:8888/lab/tree/Andi/pigmentation/code/~/miniconda3/Lib/site-packages/colour_checker_detection/detection/inference.py#line=217), in inferencer_default(image, cctf_encoding, apply_cctf_encoding, show)
    206     output_results = os.path.join(temp_directory, "output-results.npz")
    207     subprocess.call(
    208         [  # noqa: S603
    209             sys.executable,
   (...)
    216         + (["--show"] if show else [])
    217     )
--> 218     results = np.load(output_results, allow_pickle=True)["results"]
    219 finally:
    220     shutil.rmtree(temp_directory)

File[ ~\miniconda3\Lib\site-packages\numpy\lib\npyio.py:427](http://localhost:8888/lab/tree/Andi/pigmentation/code/~/miniconda3/Lib/site-packages/numpy/lib/npyio.py#line=426), in load(file, mmap_mode, allow_pickle, fix_imports, encoding, max_header_size)
    425     own_fid = False
    426 else:
--> 427     fid = stack.enter_context(open(os_fspath(file), "rb"))
    428     own_fid = True
    430 # Code to distinguish from NumPy binary files and pickles.

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\CYBERT~1\\AppData\\Local\\Temp\\tmpxan6xbhi\\output-results.npz'

The images were correctly plotted in the
previous part (Caption: "Images").

Do you have an idea what I might try? T

Code for Reproduction

No response

Exception Message

No response

Environment Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions