wisdomikezogwo / quilt1m

[NeurIPS 2023 Oral] Quilt-1M: One Million Image-Text Pairs for Histopathology.
https://quilt1m.github.io/
MIT License
138 stars 8 forks source link

Error in data_utils.py #7

Closed vinid closed 1 year ago

vinid commented 1 year ago

Hello!

After downloading the videos I get an error running

python -m main --base_dir ${BASE_DIR}

the stack trace is as follows;

Traceback (most recent call last):
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 166, in <module>
    main(args, data_df, recon_df, device, histo_models_dict, video_paths_dict)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 68, in main
    rep_chunk_im_temp = save_frame_chunks_recon(video_path, stable_times, chunk_id,fps, height, width)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/data_utils.py", line 108, in save_frame_chunks_recon
    clip_start_time, clip_end_time = start_end_time
TypeError: cannot unpack non-iterable int object

Some additional variables that can help in understanding what's happening

>>> stable_se_times 
(2, 17) 
>>> start_end_time
2

basically, the assignment coming from start_end_time generates an error due to the line

clip_start_time, clip_end_time = start_end_time

Any clue on where this might come from?

Thanks!

wisdomikezogwo commented 1 year ago

Yeah I might be able to debug this this weekend, Can you provide the video_id for ease of debugging?

start_end_time should be a tuple, not an int?

wisdomikezogwo commented 1 year ago

In the mean time, could you try changing line 61 in main.py to

 stable_times = list_idle_im_se_t_tup[chunk_id][chunk_id]

i.e removing [0]

vinid commented 1 year ago

thanks! That works now! but I get another error, unfortunately (I will open another issue).

Does main.py work end-to-end on your side? like, if you run the script from your local data/ folder does it do the frame splitting?

Thanks so much!

wisdomikezogwo commented 1 year ago

yeah, it did, but I only tested on a few videos, can you provide m the particular video_id(s) and I'll run some tests again and update the code if need be?

vinid commented 1 year ago

0QZ_6HCVIo4

The error is the following one:

ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

Traceback:


Traceback (most recent call last):
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 167, in <module>
    main(args, data_df, recon_df, device, histo_models_dict, video_paths_dict)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 118, in main
    ssim_val = structural_similarity(crop1, crop2, multichannel=True)
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/site-packages/skimage/metrics/_structural_similarity.py", line 178, in structural_similarity
    raise ValueError(
ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.
vinid commented 1 year ago

Ok, the error is there only for some of the video ids, but I still can not do a full run of the script.

Another quick Q: how long does it usually take to run the entire pipeline?

vinid commented 1 year ago

Hello! Just checking in too see if I had time to check this!

Thank you so much!

vinid commented 1 year ago

Solved

wisdomikezogwo commented 1 year ago

Hi,

I unfortunately have been unavailable for a while and still am, but I'm happy to know it's a non-issue now, if you could open a PR for the fix to the problematic ids that would be really appreciated.

:)

wisdomikezogwo commented 1 year ago

Ok, the error is there only for some of the video ids, but I still can not do a full run of the script.

Another quick Q: how long does it usually take to run the entire pipeline?

Just gave an answer to a similar Qeustion here: https://github.com/wisdomikezogwo/quilt1m/issues/8#issuecomment-1652236966

trinhvg commented 11 months ago

0QZ_6HCVIo4

The error is the following one:

ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

Traceback:

Traceback (most recent call last):
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 167, in <module>
    main(args, data_df, recon_df, device, histo_models_dict, video_paths_dict)
  File "/oak/stanford/groups/jamesz/pathtweets/quilt/quilt1m/data/main.py", line 118, in main
    ssim_val = structural_similarity(crop1, crop2, multichannel=True)
  File "/home/groups/jamesz/fede/miniconda/lib/python3.10/site-packages/skimage/metrics/_structural_similarity.py", line 178, in structural_similarity
    raise ValueError(
ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

Hi, how did you solve this problem? I have the same one. I would really appreciate it if you could provide a solution. Thank you.

wisdomikezogwo commented 11 months ago

Hi @trinhvg,

I will test this out this weekend, before then if you have more videos that throw this error, please send it my way. I think it may come from the video download property and/or crop size of SSIM.