What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?

What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?  

  By: bilalUWE on Aug. 28, 2022, 12:11 a.m.

Hi Organizers,

What goes into the VideoLoader.load()? 1. video file name (endoscopic-robotic-surgery-video.mp4) only or 2. fully qualified video file name (/input/endoscopic-robotic-surgery-video.mp4) or 3. just the folder name (/input)

I am tracing to the error Could not find an int in the string 'endoscopic-robotic-surgery-video'. which occurs when VideoLoader.load() doesn't find the video file for the path in fname. I am getting the following error:

Traceback (most recent call last): File "/opt/conda/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/conda/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/opt/algorithm/process.py", line 222, in Surgtoolloc_det().process() File "/home/algorithm/.local/lib/python3.10/site-packages/evalutils/evalutils.py", line 181, in process self.load() File "/home/algorithm/.local/lib/python3.10/site-packages/evalutils/evalutils.py", line 123, in load self._cases[key] = self._load_cases( File "/home/algorithm/.local/lib/python3.10/site-packages/evalutils/evalutils.py", line 157, in _load_cases raise FileLoaderError( evalutils.exceptions.FileLoaderError: Could not load any files in /input with <main.VideoLoader object at 0x7f91cb520310>.

This shows that VideoLoader.load() function receives only the folder name /input with python -m process call. Check the last line in the error message. Is this the correct behaviour. I assumed a fully qualitifed video file name will be passed to the VideoLoader.load() automatically which seems wrong.

If that is true then do we have to check the folder for the video named endoscopic-robotic-surgery-video.mp4 as expected.

Any ideas to resolve this error will be much appreciated as this error is the only one stopping us to make one successful submission.

Many Thanks and

Kind Regards, Bilal

 Last edited by: bilalUWE on Aug. 15, 2023, 12:57 p.m., edited 4 times in total.

Re: What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?  

  By: bilalUWE on Aug. 28, 2022, 9:52 a.m.

The error Could not find an int in the string endoscopic-robotic-surgery-video'. occurs before the Surgtoolloc() class object gets created. See the log below. I tried renaming the file exactly as suggested endoscopic-robotic-surgery-video.mp4 and hardcoded it in the VideoLoader.load() function but the error persists. What surprises me that the predict function works perfectly, scores the video and return the JSON but since this error occur prior to the function, showhow makes the system to believe that there is error in the call.

Successfully tagged surgtoolloc_trial:latest 1+0 records in 1+0 records out 32 bytes copied, 5.0701e-05 s, 631 kB/s surgtoolloc_trial-output-bc2bdd818db3037355facc6a1027ad14 Could not find an int in the string 'endoscopic-robotic-surgery-video'.

TeamZERO prediction engine has started!. -Loading key artefacts... -3 mutli-class classification models have been detected & loaded. -Tools dictionary loaded!.

INSIDE Video Loader LOAD function. /input/endoscopic-robotic-surgery-video.mp4 Inside process_case()... path /input/endoscopic-robotic-surgery-video.mp4 Name: 0, dtype: object Processing the video file: /input/endoscopic-robotic-surgery-video.mp4 through TeamZERO prediction engine

-Image extraction started.. /input/endoscopic-robotic-surgery-video.mp4 READY FOR EXTRACTION --60 images from /input/endoscopic-robotic-surgery-video.mp4 are extracted in /images folder. Extraction done!.

-Tools presence detection task started. epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
--Predictions from all models in the ensemble learner are obtained!.
--Translation of class probabilities to tool labels is done!. --Following tools remained unaccounted for: {'nan'}. Please ensure if it is OK to skip these tools from the output. --Output JSON file generated & returned!.

/input/endoscopic-robotic-surgery-video.mp4 has been successfully processed!.

[ { "slice_nr": 0, "needle_driver": false, "monopolar_curved_scissor": true, "force_bipolar": false, "clip_applier": false, "tip_up_fenestrated_grasper": false, "cadiere_forceps": true, "bipolar_forceps": true, "vessel_sealer": false, "suction_irrigator": false, "bipolar_dissector": false, "prograsp_forceps": false, "stapler": false, "permanent_cautery_hook_spatula": false, "grasping_retractor": false }, {...}, { "slice_nr": 59, "needle_driver": false, "monopolar_curved_scissor": true, "force_bipolar": false, "clip_applier": false, "tip_up_fenestrated_grasper": false, "cadiere_forceps": true, "bipolar_forceps": true, "vessel_sealer": false, "suction_irrigator": false, "bipolar_dissector": false, "prograsp_forceps": false, "stapler": false, "permanent_cautery_hook_spatula": false, "grasping_retractor": false } ] Expected output was not found... surgtoolloc_trial-output-bc2bdd818db3037355facc6a1027ad14

May I ask the teams who are successful to make the submission to kindly share their VideoLoader() class code to see what is wrong that some of us are getting this error in the docker.

 Last edited by: bilalUWE on Aug. 15, 2023, 12:57 p.m., edited 1 time in total.

Re: What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?  

  By: bilalUWE on Aug. 28, 2022, 3:44 p.m.

Dear Organizers,

Can you please share the logs for our most recent algorithm run (83ea3c9b-56b7-4870-8719-34a6de2a8785 ) that was unsuccessful again? I reduced the n_workers=2 which was 32 before and also decreased the batch size to 16 which was 64 to reduce the memory requirement of our algorithm. This was informed by the logs @kbot shared earlier.

While troubleshooting the error, I ensured the process.py uses the right paths for /input/ and /output/ folders. Our paths /opt/algorithm/input/ and /opt/algorithm/output/ were wrong which were causing some path-related issues when DetectionAlgorithm object gets created by the library.

I feel the error Could not find an int in the string endoscopic-robotic-surgery-video is generated as the evalutils expects the file name to contain an integer. It tried the 'python -m process' with video files with and without integer in their names on my local docker. I stopped getting the error for the video file name containing the integer. See the logs below:

You are likely to get the error if video file name contains no int: algorithm@cc52870ec34e:/opt/algorithm$ python -m process TeamZERO prediction engine has started!. -Loading key artefacts... -3 mutli-class classification models have been detected & loaded. -Tools dictionary loaded!.

Inside Video Loader Load Function. /input/endoscopic-robotic-surgery-video.mp4 Could not find an int in the string 'endoscopic-robotic-surgery-video'. Inside process_case()... path /input/endoscopic-robotic-surgery-video.mp4 Name: 0, dtype: object Processing the video file: /input/endoscopic-robotic-surgery-video.mp4 through TeamZERO prediction engine

-Image extraction started.. /input/endoscopic-robotic-surgery-video.mp4 ready for frame extraction. --60 images from /input/endoscopic-robotic-surgery-video.mp4 are extracted in /images folder. Extraction done!.

-Tools presence detection task started. epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
--Predictions from all models in the ensemble learner are obtained!.
--Translation of class probabilities to tool labels is done!. --Following tools remained unaccounted for: {'nan'}. Please ensure if it is OK to skip these tools from the output. --Output JSON file generated & returned!.

/input/endoscopic-robotic-surgery-video.mp4 has been successfully processed!.

But the run stopped generating the error if the video name has an integer:

algorithm@20e5f3358165:/opt/algorithm$ python -m process TeamZERO prediction engine has started!. -Loading key artefacts... -3 mutli-class classification models have been detected & loaded. -Tools dictionary loaded!.

Inside Video Loader Load Function. /input/endoscopic-robotic-surgery-video1.mp4 Inside process_case()... path /input/endoscopic-robotic-surgery-video1.mp4 Name: 0, dtype: object Processing the video file: /input/endoscopic-robotic-surgery-video1.mp4 through TeamZERO prediction engine

-Image extraction started.. /input/endoscopic-robotic-surgery-video1.mp4 ready for frame extraction. --60 images from /input/endoscopic-robotic-surgery-video1.mp4 are extracted in /images folder. Extraction done!.

-Tools presence detection task started. epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
epoch train_loss valid_loss usm1_loss usm2_loss usm3_loss usm4_loss usm1_err usm2_err usm3_err usm4_err combo_err time
--Predictions from all models in the ensemble learner are obtained!.
--Translation of class probabilities to tool labels is done!. --Following tools remained unaccounted for: {'nan'}. Please ensure if it is OK to skip these tools from the output. --Output JSON file generated & returned!.

/input/endoscopic-robotic-surgery-video1.mp4 has been successfully processed!.

If this is the likely cause of the error then I don't think we can control naming video files in our code. Appropriate names shall be set of video files by the organizers with int in their names. Forgive me if I am wrong.

May I ask the organizers to please share the log of the above mentined algorithm run here so that I can investigate if something else is not causing this error?

Thanks

 Last edited by: bilalUWE on Aug. 15, 2023, 12:57 p.m., edited 3 times in total.

Re: What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?  

  By: YaqinLong on Aug. 30, 2022, 2:58 p.m.

Hi,

Have you solved the problems with "VideoLoad()"? I I have no problem executing the code with vscode. But when I executed test.sh, it said:" evalutils.exceptions.FileLoaderError: Could not load any files in test with ".

I would be appreciated if you could help me.

Thanks,

Re: What video file name gets passed to `VideoLoader.load()` as fname with `python -m process` command?  

  By: aneeqzia_isi on Aug. 30, 2022, 11:34 p.m.

The issue of int not found in the filename is a bug in grand-challenge system, however it doesn not effect the algorithm run (it will proceed but with warnings).

@bilalUWE: we've replied back on your email with logs from your recent runs

@YaqinLong: test.sh is an example script that each team would need to modify and create their own tests based on docker images. It is not necessary to pass that script as each team will have different outputs and the .sh file would need to be modified accordingly for local testing. Primarily, the output format of the json file needs to be accurate for the algorithm container to be successfull.