Got Bad result after inference command

TLT Version → docker_tag: v3.21.08-py3
Network Type → Yolov4
training spec file →
spec.txt (2.5 KB)


After Training till 100 epochs I got 96 map. But still getting bad result.

After running inference part I am getting bad result like multiple bounding boxes. There are only 3 classes images I have in my dataset with proper annotation.1536 images in the training set and 384 images in the validation dataset. I am not able to understand why the model is behaving like this. Find the attached spec file for your reference.

I have also attached the inference result of two images below. Looking forward for the help from your side.

Inference Results →
Image 1 →

Image 2 →

May I know how did you run inference? Using "tao yolov4 inference xxx "?


My inference commad is :> tao yolo_v4 inference -i /workspace/tao-experiments/test_images -o /workspace/tao-experiments/specs -e /workspace/tao-experiments/specs/spec.txt -m /workspace/tao-experiments/results/weights/yolov4_resnet18_epoch_100.tlt -k KEY

To narrow down, can you run inference against your val dataset?

I tried with the validation dataset and as well as tried on some other images by downloading
from the google but I am got the same bad result after inference command.


I am waiting for your reply

So, you mean you get bad result even with validation dataset, right?
That is not expected because you mention that the training got 96% mAP. The mAP is evaluated via your validation dataset.
Could you double check your training log?

yeah, I got the bad result even with validation dataset. map is evaluated via validation dataset. in the training log at 90 epochs I got 98% and at 100 epoch I got 100% map. So i just used the model file of 90 epochs in order to run inference but got the bad result. Do i need to change something in the nms_config in order to get good result (having single bounding box)?

So, you mentioned with below.
“tao yolov4 evaluate xxx” against your val dataset: according to your training result, it is 98%.
But with
“tao yolov4 inference xxx” against your val dataset: the result is bad.

Could you double check? It does not make sense.

in both the cases i got bad result whether i am using validation dataset (images which are present in the dataset) for inference part or not.

Could you share your training log?

Here is the training log

training log :->
yolov4_training_log_resnet18.csv (6.2 KB)

To narrow down, could you run "tao evaluate xxx " against the last .tlt model ?

I ran the inference part by using the last tlt model file i.e which comes at 100th epoch. As in the log file its 100% map of the last model file.

It is very strange that you get different result between evaluation in the training and “tao yolo_v4 evaluate xxx”. Actually they should be the same.

Can you share all the command and log when you run “tao evaluate xxx”?

log file i have already shared to u. I am sharing few commands that i have used

first I had calculated the anchor box using this command and put those shape values inside the spec file.

Command to get anchor shape :-
tao yolo_v4 kmeans -l “/workspace/tao-experiments/labels” -i “/workspace/tao-experiments/images” -x 416 -y 416

then used training command,training went upto 100 epcoh as i mentioned in the spec file.
Training command->
tao yolo_v4 train --gpus 1 -e /workspace/tao-experiments/specs/spec.txt -r /workspace/tao-experiments/results -k KEY

after training I got 100% accuracy at 100th epoch. After that i ran the evaluation command
Evaluation command →
tao yolo_v4 evaluate -e /workspace/tao-experiments/specs/spec.txt -m /workspace/tao-experiments/results/weights/yolov4_resnet18_epoch_100.tlt -k KEY

after running the evalutation command I got output like this :-

Start to calculate AP for each class

biscuits AP 1.0
chips AP 1.0
chocolate AP 1.0
mAP 1.0

then at last I just ran the inference command :-

Inference command → tao yolo_v4 inference -i /workspace/tao-experiments/val/images -o /workspace/tao-experiments/results -e /workspace/tao-experiments/specs/spec.txt -m /workspace/tao-experiments/results/weights/yolov4_resnet18_epoch_100.tlt -k KEY

then I am able to get that bad result as output images which i already shared to u

So, according to your result, the "tao yolo_v4 evaluate xxx " is good, right?
This matches the evaluation result during the training.

right…the only thing i am not able to understand is the multiple bounding appears in the output images. how to overcome from this multiple bounding box issue?

Can you resize several images of val dataset( /workspace/tao-experiments/val/images ) to 416x416 and re-run "tao yolo_v4 inference xxx ?

the below result I am getting after converting images into 416*416


Still getting bad result