orrzohar / PROB

[CVPR 2023] Official Pytorch code for PROB: Probabilistic Objectness for Open World Object Detection
Apache License 2.0
112 stars 16 forks source link

Task 4 error #37

Closed sf-pear closed 1 year ago

sf-pear commented 1 year ago

Hi Orr, everything was going smoothly until I got to task 4. At the end when generating the exemplar file for task 4, I got the following error:

Urchin has 1 predictions.
Fish has 0 predictions.
Sea star has 0 predictions.
Anemone has 0 predictions.
Sea cucumber has 0 predictions.
Sea pen has 0 predictions.
Sea fan has 19 predictions.
Worm has 0 predictions.
Crab has 0 predictions.
Gastropod has 0 predictions.
Shrimp has 0 predictions.
Soft coral has 0 predictions.
Glass sponge has 0 predictions.
Feather star has 0 predictions.
Eel has 1867 predictions.
Squat lobster has 11 predictions.
Barnacle has 0 predictions.
Stony coral has 0 predictions.
Black coral has 0 predictions.
Sea spider has 0 predictions.
unknown has 165102 predictions.
detection mAP50: 1.961324
detection mAP: 1.961324
---AP50---
Wilderness Impact: {0.1: {50: 0.0}, 0.2: {50: 0.0}, 0.3: {50: 0.0}, 0.4: {50: 0.0}, 0.5: {50: 0.0}, 0.6: {50: 0.0}, 0.7: {50: 0.0}, 0.8: {50: 0.0}, 0.9: {50: 0.0}}
avg_precision: {0.1: {50: 0.0}, 0.2: {50: 0.0}, 0.3: {50: 0.0}, 0.4: {50: 0.0}, 0.5: {50: 0.0}, 0.6: {50: 0.0}, 0.7: {50: 0.0}, 0.8: {50: 0.0}, 0.9: {50: 0.0}}
Absolute OSE (total_num_unk_det_as_known): {50: 0.0}
total_num_unk 0
AP50: ['9.1', '0.0', '0.0', '0.0', '0.0', '0.0', '9.1', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '21.2', '1.8', '0.0', '0.0', '0.0', '0.0', '0.0']
Precisions50: ['100.0', '0.0', '0.0', '0.0', '0.0', '0.0', '78.9', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '3.4', '9.1', '0.0', '0.0', '0.0', '0.0', '0.0']
Recall50: ['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '3.2', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '86.5', '3.1', '0.0', '0.0', '0.0', '0.0', 'nan']
Prev class AP50: tensor(1.2987)
Prev class Precisions50: 12.781954887218046
Prev class Recall50: 0.23057421923603336
Current class AP50: tensor(3.8343)
Current class Precisions50: 2.086478063982081
Current class Recall50: 14.935247747747747
Known AP50: tensor(2.0594)
Known Precisions50: 9.573311840247257
Known Recall50: 4.6419762777895475
Unknown AP50: tensor(0.)
Unknown Precisions50: 0.0
Unknown Recall50: nan
Urchin 9.090909
Fish 0.000000
Sea star 0.000000
Anemone 0.000000
Sea cucumber 0.000000
Sea pen 0.000000
Sea fan 9.090909
Worm 0.000000
Crab 0.000000
Gastropod 0.000000
Shrimp 0.000000
Soft coral 0.000000
Glass sponge 0.000000
Feather star 0.000000
Eel 21.187799
Squat lobster 1.818182
Barnacle 0.000000
Stony coral 0.000000
Black coral 0.000000
Sea spider 0.000000
unknown 0.000000
[ExempReplay]  [ 0/61]  eta: 0:00:21  loss: 10.0000 (10.0000)  time: 0.3489  data: 0.0000  max mem: 23363
[ExempReplay]  [10/61]  eta: 0:00:17  loss: 60.0000 (60.0000)  time: 0.3373  data: 0.0000  max mem: 23363
[ExempReplay]  [20/61]  eta: 0:00:13  loss: 110.0000 (110.0000)  time: 0.3296  data: 0.0000  max mem: 23363
[ExempReplay]  [30/61]  eta: 0:00:10  loss: 210.0000 (160.0000)  time: 0.3209  data: 0.0000  max mem: 23363
[ExempReplay]  [40/61]  eta: 0:00:06  loss: 310.0000 (210.0000)  time: 0.3191  data: 0.0000  max mem: 23363
[ExempReplay]  [50/61]  eta: 0:00:03  loss: 410.0000 (260.0000)  time: 0.3209  data: 0.0000  max mem: 23363
[ExempReplay]  [60/61]  eta: 0:00:00  loss: 510.0000 (310.0000)  time: 0.3133  data: 0.0000  max mem: 23363
[ExempReplay] Total time: 0:00:19 (0.3212 s / it)
found a total of 610 images
found a total of 610 images
only found 18 imgs in class 17
only found 4 imgs in class 18
only found 0 imgs in class 19
Traceback (most recent call last):
  File "/home/sabrina/code/PROB/main_open_world.py", line 475, in <module>
    main(args)
wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing.
  File "/home/sabrina/code/PROB/main_open_world.py", line 387, in main
    create_ft_dataset(args, image_sorted_scores)
  File "/home/sabrina/code/PROB/main_open_world.py", line 439, in create_ft_dataset
    max_val = tmp.min()
RuntimeError: min(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.

How I ran it:

# train task 4
PY_ARGS=${@:1}
python -u main_open_world.py \
    --output_dir "${EXP_DIR}/t4" --dataset fathomnet --PREV_INTRODUCED_CLS 14 --CUR_INTRODUCED_CLS 6\
    --train_set 'task4_train' --test_set 'all_test' --epochs 191 \
    --model_type 'prob' --obj_loss_coef 8e-4 --freeze_prob_model --obj_temp 1.3\
    --wandb_name "${WANDB_NAME}_t4"\
    --exemplar_replay_selection --exemplar_replay_max_length 2749 --exemplar_replay_dir ${WANDB_NAME}\
    --exemplar_replay_prev_file "t3_ft.txt" --exemplar_replay_cur_file "t4_ft.txt"\
    --num_inst_per_class 40\
    --pretrain "${EXP_DIR}/t3_ft/checkpoint0180.pth" --lr 2e-5\
    ${PY_ARGS}

Have you come across this before?

orrzohar commented 1 year ago

Hi @sf-pear,

Unfortunately, no, but this seems to be happing because:

only found 0 imgs in class 19

so because no images with class 19 were found, when you did min() then, you got an error. to do active ft selection, the model needs to detect some objects.

What I would do in your case is that in cases where the model detected NO objects, you do not do active selecting and instead randomly select some images with that object.

This probably is happening because your dataset is much smaller than COCO.

Best, Orr

sf-pear commented 1 year ago

Makes sense, thank you very much for your help!

orrzohar commented 1 year ago

Hi @sf-pear, If you have difficulty making it work, LMK. Best Orr