ValueError: axes don't match array

Hi Guys,

I am trying to run the trained model (for 2 classes) on a test data set. However, I get the following error when I try to do so:

_________________________________________________________________

Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, 3, 480, 480)       0         
_________________________________________________________________
model_1 (Model)              [(None, 2, 30, 30), (None 937642    
=================================================================
Total params: 937,642
Trainable params: 934,794
Non-trainable params: 2,848

2019-11-25 04:43:27,795 [INFO] iva.detectnet_v2.scripts.inference: Initialized model
2019-11-25 04:43:27,806 [INFO] iva.detectnet_v2.scripts.inference: Commencing inference
0it [00:00, ?it/s]
  0%|          | 0/64 [00:00<?, ?it/s]
  2%|1         | 1/64 [00:00<00:12,  5.20it/s]
 22%|##1       | 14/64 [00:00<00:06,  7.31it/s]
 44%|####3     | 28/64 [00:00<00:03, 10.20it/s]
 66%|######5   | 42/64 [00:00<00:01, 14.11it/s]
100%|##########| 64/64 [00:00<00:00, 95.82it/s]
1it [00:04,  4.37s/it]
Traceback (most recent call last):
  File "/usr/local/bin/tlt-infer", line 10, in <module>
    sys.exit(main())
  File "./common/magnet_infer.py", line 35, in main
  File "./detectnet_v2/scripts/inference.py", line 222, in main
  File "./detectnet_v2/scripts/inference.py", line 180, in inference_wrapper_batch
  File "./detectnet_v2/inferencer/tlt_inferencer.py", line 123, in infer_batch
  File "./detectnet_v2/inferencer/base_inferencer.py", line 107, in input_preprocessing
ValueError: axes don't match array

Please find the contents of the clusterfile below:

{
    "dbscan_criterion": "IOU",
    "dbscan_eps": {
        "person": 0.35,
        "car": 0.25,
        "default": 0.15
    },
    "dbscan_min_samples": {
        "person": 0.05,
        "car": 0.05,
        "default": 0.0
    },
    "min_cov_to_cluster": {
        "person": 0.005,
        "car": 0.005,
        "default": 0.005
    },
    "min_obj_height": {
        "person": 4,
        "car": 4,
        "default": 2
    },
    "target_classes": ["person","car"],
    "confidence_th": {
        "person": 0.9,
        "car": 0.9
    },
    "confidence_model": {
        "person": { "kind": "aggregate_cov"},
        "car": { "kind": "aggregate_cov"}
    },
    "output_map": {
        "person": "person",
        "car": "car"
    },
    "color": {
        "person": "blue",
        "car": "green",
        "default": "black"
    },
    "postproc_classes": ["person", "car"],
    "image_height": 480,
    "image_width": 480,
    "stride": 16
}

Please help me out.

Thanks

Hi neophyte1,
Could you please paste your full command and log? thanks.

Hi Morganh,

Please find the command below:

!tlt-infer detectnet_v2 -i $USER_EXPERIMENT_DIR/data/testing/image_2 \
                        -o $USER_EXPERIMENT_DIR/tlt_infer_testing_oi \
                        -m $USER_EXPERIMENT_DIR/experiment_dir_retrain/weights/resnet10_detector_pruned_2classes.tlt \
                        -cp $SPECS_DIR/detectnet_v2_clusterfile_kitti_2classes.json \
                        -k $KEY \
                        --kitti_dump \
                        -lw 3 \
                        -g 0 \
                        -bs 64

I have observed that few images with the same resolution work while others do not. I am unable to understand.

Thanks.

Hi neophyte1,
Are the images the same format? For example, can you check if some are BGR but others are not?

Hi neophyte1,

Any update? Is this still an issue to support?

Hi neophyte1,

We haven’t heard back from you in a couple weeks, so marking this topic is not an issue.
Please open a new forum issue when you are ready and we’ll pick it up there.

I also experienced the same issue. It turns out, some of my images are BGR, and some are RGB. To make sure, you can just show all of your images inside your jupyter notebook.

Some of my testing images were gray-scale and that’s why I got this error. Didn’t have anything to do with BGR / RGB.