Output directory 'images/pelvic-fracture-ct-segmentation' is empty

Output directory 'images/pelvic-fracture-ct-segmentation' is empty  

  By: shirshak.acharya on July 5, 2024, 9:32 a.m.

Hello, Sorry for causing errors, But I have saved the output like this:

> Path(join(OUTPUT_PATH, 'images/pelvic-fracture-ct-segmentation')).mkdir(parents=True, exist_ok=True)
> write_array_as_image_file(location=OUTPUT_PATH / "images/pelvic-fracture-ct-segmentation", array=overall_mask)

Where write_array_as_image_file is taken from author's code. Now, I try to run the algorithm image, it showed me the error as: Output directory 'images/pelvic-fracture-ct-segmentation' is empty.

Re: Output directory 'images/pelvic-fracture-ct-segmentation' is empty  

  By: shirshak.acharya on July 5, 2024, noon

Hi, I think the input is not read correctly by the model, As in the function inside inference.py given by author ----> load_image_file_as_array

 input_files = glob(str(location / "*.mha")
result = SimpleITK.ReadImage(input_files[0])

When I try to run above command, the error goes: IndexError: list index out of range

I think it we are not being able to read the image, as the image doesnot exist....

Re: Output directory 'images/pelvic-fracture-ct-segmentation' is empty  

  By: YSang on July 6, 2024, 4:17 a.m.

Please try to test your container locally first, by running the test_run script after replacing the replace-with-your-test-image.mha in the input folder.

https://github.com/YzzLiu/PENGWIN-example-algorithm/blob/main/PENGWIN-challenge-packages/preliminary-development-phase-ct/test_run.sh

This script should be able to designate the directories correctly.

INPUT_DIR="${SCRIPT_DIR}/test/input" OUTPUT_DIR="${SCRIPT_DIR}/test/output"

Re: Output directory 'images/pelvic-fracture-ct-segmentation' is empty  

  By: shirshak.acharya on July 8, 2024, 11:14 a.m.

Hello, thanks for feedback , I tried to test the model using test.sh script. I get the output from the model as:

(array([ 0, 1, 11, 12, 13, 14, 21]), array([2032251, 16764, 15965, 5649, 986, 705, 24832]))

=+= Wrote results to /home/shirshak/Pengwin_Submission_Portal/test/output

=+= Save this image for uploading via save.sh "example-algorithm-preliminary-development-phase-ct"

Container saved as /home/shirshak/Pengwin_Submission_Portal/example-algorithm-preliminary-development-phase-ct_20240708_164253.tar.gz

The model gives okay prediction when I am providing data, from this command on docker:

COPY --chown=user:user ./test/input/*.mha /opt/app/input/images/pelvic-fracture-ct/

I have also tried to save the container by adding bash save.sh command on the test_run.sh file at the end.
Yes, it designated the directories correctly, when i am providing data from above command on docker. Hello, Yudi, is this what you meant?

 Last edited by: shirshak.acharya on July 8, 2024, 11:17 a.m., edited 1 time in total.

Re: Output directory 'images/pelvic-fracture-ct-segmentation' is empty  

  By: YSang on July 8, 2024, 12:37 p.m.

This might not be what I meant. The input and output folders are included via docker volume when running the container, and should not be copied and pasted into the container itself directly when building it.

This was done by the following command in test_run.sh

docker run --rm \
    --platform=linux/amd64 \
    --network none \
    --gpus all \
    --volume "$INPUT_DIR":/input \
    --volume "$OUTPUT_DIR":/output \
    --volume "$DOCKER_NOOP_VOLUME":/tmp \
    $DOCKER_TAG

Please try to run test_run.sh before save.sh.