Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ankana-001 opened this issue Aug 17, 2024 · 1 comment
Open

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

ankana-001 opened this issue Aug 17, 2024 · 1 comment

Comments

@ankana-001
Copy link

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
Copy link
Author

any update on this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant