tlt-infer detectnet_v2 ValueError: No JSON object could be decoded

Command:
root@f701303ab0c5:/workspace/tlt-experiments# tlt-infer detectnet_v2
-m /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/model/model.step-5255.tlt
-i /workspace/tlt-experiments/VDOT/test1
-o /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/inference
-bs 24
-cp /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/cluster_params_file.json
-lw 3 -k <personal_key_omitted_from_post>

Output:
Using TensorFlow backend.
2020-01-09 15:07:29,660 [INFO] iva.detectnet_v2.scripts.inference: Overlain images will not be saved in the output path.

Error:
Traceback (most recent call last):
File “/usr/local/bin/tlt-infer”, line 10, in
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 125, in inference_wrapper_batch
File “/usr/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “/usr/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded

Mock cluster_params_file.json:

postprocessing_config {
target_class_config {
key: “Car”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
}

What is malformed in my command? Please HALP!

I will also note that my input images for training the detectnet_v2 model did not conform to the width and height requirement of being a multiple of 16. My input images were 800x600 but tfrecord conversion did not error, and model training did not error either.

Sincerely,
kwindham

Hi kwindham,
Could you paste your full content of /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/cluster_params_file.json?

You can find a reference json file under /workspace/examples/detectnet_v2/specs/ , then to check if your json has something difference which may results in this error.

Here is the file:
cluster_params_file.json
postprocessing_config {
target_class_config {
key: “Vehicle0”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle1”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle2”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle3”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle4”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle5”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle6”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle7”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle8”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle9”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle10”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle11”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle12”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle13”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle14”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle15”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle17”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle18”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle19”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle20”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle21”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
target_class_config {
key: “Vehicle22”
value {
clustering_config {
coverage_threshold: 0.005
dbscan_eps: 0.13
dbscan_min_samples: 0.05
minimum_bounding_box_height: 4
}
}
}
}

Hi kwindham,
Could you refer to /workspace/examples/detectnet_v2/specs/detectnet_v2_clusterfile_kitti.json ?
The “-cp” option means a cluster_params_file. It is Bbox post processing json file.

Yours is not correct. It looks like below if using kitti dataset.

{
    "dbscan_criterion": "IOU",
    "dbscan_eps": {
        "cyclist": 0.25,
        "pedestrian": 0.35,
        "default": 0.15,
        "car": 0.3
    },
    "dbscan_min_samples": {
        "cyclist": 0.05,
        "pedestrian": 0.05,
        "default": 0.0,
        "car": 0.05
    },
    "min_cov_to_cluster": {
        "cyclist": 0.005,
        "pedestrian": 0.005,
        "default": 0.005,
        "car": 0.005
    },
    "min_obj_height": {
        "cyclist": 4,
        "pedestrian": 4,
        "car": 4,
        "default": 2
    },
    "target_classes": ["car", "cyclist", "pedestrian"],
    "confidence_th": {
        "pedestrian": 0.6,
        "cyclist": 0.6,
        "car": 0.6
    },
    "confidence_model": {
        "car": { "kind": "aggregate_cov"},
        "pedestrian": { "kind": "aggregate_cov"},
        "cyclist": { "kind": "aggregate_cov"},
        "default": { "kind": "aggregate_cov"}
    },
    "output_map": {
        "car" : "car",
        "cyclist" : "cyclist",
        "pedestrian" : "pedestrian"
    },
    "color": {
        "car": "green",
        "cyclist": "magenta",
        "pedestrian": "cyan",
        "default": "blue"
    },
    "postproc_classes": ["car", "cyclist", "pedestrian"],
    "image_height": 384,
    "image_width": 1248,
    "stride": 16
}

Hi Morganh,

Thank you for your help, I have updated the file and I no longer get the JSON object error. I am now receiving a different error “Unhashable type”:

COMMAND:
root@90a3793c78ae:/workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0# tlt-infer detectnet_v2 -m /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/model/model.step-5255.tlt -i /workspace/tlt-experiments/INFERENCE_TEST/inference_test_320x224 -o /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/inference -bs 2 -cp /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/detectnet_v2_inference_config.json -lw 3 -k <KEY_OMITTED_FOR_THIS_POST>

OUTPUT:
Using TensorFlow backend.
2020-01-13 18:00:22,589 [INFO] iva.detectnet_v2.scripts.inference: Overlain images will not be saved in the output path.
2020-01-13 18:00:22,590 [INFO] iva.detectnet_v2.inferencer.build_inferencer: Constructing inferencer
2020-01-13 18:00:22.590544: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-01-13 18:00:22.681393: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-01-13 18:00:22.681820: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x5b64190 executing computations on platform CUDA. Devices:
2020-01-13 18:00:22.681839: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): GeForce RTX 2070, Compute Capability 7.5
2020-01-13 18:00:22.705966: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3696000000 Hz
2020-01-13 18:00:22.706499: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x5bcc770 executing computations on platform Host. Devices:
2020-01-13 18:00:22.706538: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,
2020-01-13 18:00:22.706855: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties:
name: GeForce RTX 2070 major: 7 minor: 5 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
totalMemory: 7.79GiB freeMemory: 7.07GiB
2020-01-13 18:00:22.706869: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2020-01-13 18:00:22.707378: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-13 18:00:22.707389: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0
2020-01-13 18:00:22.707396: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N
2020-01-13 18:00:22.707484: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6874 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2070, pci bus id: 0000:01:00.0, compute capability: 7.5)
2020-01-13 18:00:22,707 [INFO] iva.detectnet_v2.inferencer.tlt_inferencer: Loading model from /workspace/tlt-experiments/Experiments/DetectNet_V2/experiment0/model/model.step-5255.tlt:
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2020-01-13 18:00:22,959 [WARNING] tensorflow: From /usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
/usr/local/lib/python2.7/dist-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: ’


Layer (type) Output Shape Param #

input_1 (InputLayer) (None, 3, 224, 320) 0


model_1 (Model) multiple 11604718

Total params: 11,604,718
Trainable params: 11,427,566
Non-trainable params: 177,152


2020-01-13 18:00:25,359 [INFO] iva.detectnet_v2.scripts.inference: Initialized model
2020-01-13 18:00:25,360 [INFO] iva.detectnet_v2.scripts.inference: Commencing inference
0it [00:00, ?it/s]2020-01-13 18:00:26.660909: E tensorflow/stream_executor/cuda/cuda_driver.cc:806] failed to allocate 3.58G (3849718784 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory
0it [00:01, ?it/s]

ERROR:
Traceback (most recent call last):
File “/usr/local/bin/tlt-infer”, line 10, in
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 185, in inference_wrapper_batch
File “./detectnet_v2/postprocessor/bbox_handler.py”, line 73, in bbox_preprocessing
File “./detectnet_v2/postprocessor/bbox_handler.py”, line 99, in abs_bbox_converter
File “/usr/local/lib/python2.7/dist-packages/addict/addict.py”, line 64, in getitem
if name not in self:
TypeError: unhashable type

CONTENTS OF: detectnet_v2_inference_config.json
{
“dbscan_criterion”: “IOU”,
“dbscan_eps”: {
“car0”: 0.3,
“car1”: 0.3,
“car2”: 0.3,
“car3”: 0.3,
“car4”: 0.3,
“car5”: 0.3
},
“dbscan_min_samples”: {
“car0”: 0.05,
“car1”: 0.05,
“car2”: 0.05,
“car3”: 0.05,
“car4”: 0.05,
“car5”: 0.05
},
“min_cov_to_cluster”: {
“car0”: 0.005,
“car1”: 0.005,
“car2”: 0.005,
“car3”: 0.005,
“car4”: 0.005,
“car5”: 0.005
},
“min_obj_height”: {
“car0”: 4,
“car1”: 4,
“car2”: 4,
“car3”: 4,
“car4”: 4,
“car5”: 4
},
“target_classes”: [“car0”, “car1”, “car2”, “car3”, “car4”, “car5”],
“confidence_th”: {
“car0”: 0.6,
“car1”: 0.6,
“car2”: 0.6,
“car3”: 0.6,
“car4”: 0.6,
“car5”: 0.6
},
“confidence_model”: {
“car0”: { “kind”: “aggregate_cov”},
“car1”: { “kind”: “aggregate_cov”},
“car2”: { “kind”: “aggregate_cov”},
“car3”: { “kind”: “aggregate_cov”},
“car4”: { “kind”: “aggregate_cov”},
“car5”: { “kind”: “aggregate_cov”}
},
“output_map”: {
“car0”: “car0”,
“car1”: “car1”,
“car2”: “car2”,
“car3”: “car3”,
“car4”: “car4”,
“car5”: “car5”
},
“color”: {
“car0” : “red”,
“car1” : “red”,
“car2” : “red”,
“car3”: “red”,
“car4”: “red”,
“car5”: “red”
},
“postproc_classes”: [“car0”, “car1”, “car2”, “car3”, “car4”, “car5”],
“image_height”: 224,
“image_width”: 320,
“stride”: 16
}

I’m not sure what the issue is at this point. I have tried simplifying the file, utilizing the same colors, etc. Thank you for your time and help!

Sincerely,
kwindham

Ah I found the problem. I did not include all of the classes and can now infer. However I have another problem with getting mAP 0% when training on my data. I will open a new issue and this thread can be closed. Thank you Morganh!

Good to know this, kwindham. I’m closing this topic.