TissueImageAnalytics / CoNIC

CoNIC Challenge
60 stars 18 forks source link

In the baseline code type index is out of range #17

Open ankana-001 opened 3 months ago

ankana-001 commented 3 months ago

In the baseline code following code section

output_file = f'{OUT_DIR}/raw/file_map.dat'
output_info = joblib.load(output_file)

semantic_predictions = []
composition_predictions = []
for input_file, output_root in tqdm(output_info):
    img = cv2.imread(input_file)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    np_map = np.load(f'{output_root}.raw.0.npy')
    hv_map = np.load(f'{output_root}.raw.1.npy')
    tp_map = np.load(f'{output_root}.raw.2.npy')

    pred_map = process_segmentation(np_map, hv_map, tp_map)
    type_freqs = process_composition(pred_map)
    semantic_predictions.append(pred_map)
    composition_predictions.append(type_freqs)
semantic_predictions = np.array(semantic_predictions)
composition_predictions = np.array(composition_predictions)

I am getting this error


  0%|                                                  | 0/1018 [00:00<?, ?it/s]

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[27], line 14
     11 tp_map = np.load(f'{output_root}.raw.2.npy')
     13 pred_map = process_segmentation(np_map, hv_map, tp_map)
---> 14 type_freqs = process_composition(pred_map)
     15 semantic_predictions.append(pred_map)
     16 composition_predictions.append(type_freqs)

Cell In[25], line 21, in process_composition(pred_map)
     18 # ! not all types exist within the same spatial location
     19 # ! so we have to create a placeholder and put them there
     20 type_freqs = np.zeros(NUM_TYPES)
---> 21 type_freqs[type_freqs_[0]] = type_freqs_[1]
     22 return type_freqs

IndexError: index 250 is out of bounds for axis 0 with size 7

Because the type_map is giving out array numbers like these ([ 0, 250, 252, 253], dtype=int32) in place of 1-6.

ankana-001 commented 1 day ago

any update on this issue ?