• Hardware (T4/V100/Xavier/Nano/etc) - Tesla T4
• Network Type (Detectnet_v2/Faster_rcnn/Yolo_v4/LPRnet/Mask_rcnn/Classification/etc) - Detectnet_v2
• TLT Version - 3.0
Hi,
I have trained a model using custom dataset for classes : car and two-wheelers using trafficcamnet unpruned model as a base. I had some doubts in altering the specs file for training, pruning and retrained the model for which I got support from this post → Retrain TrafficCamNet with custom vehicle dataset using TLT 3.0
I have generated the dataset by grabbing the frames from videos and then annotating it using KITTI labelling tool.
After training the model I tried comparing it with the pretrained trafficcamnet model and the below screenshots where the results:
Custom Model Detections
Pretrained Model Detections
The custom model is not able to detect the car and two-wheelers but not persons and roadsigns. As per my understanding I have used the pretrained model as base and added dataset to increase the accuracy of car detections while retaining the older detection rate and improve it. But here I can only detect the cars and two-wheelers with low-detection rate as compared to pretraind model but not the other classes that are already trained in the pretrained model. How should I train the model in way to retain the exisiting model characteristics (detecting cars, two-wheelers, persons and roadsigns) and also improve the detection rate?
According to the training spec file, the custom model is trained on two classes (car and two-wheelers). So it can only detect the cars and two-wheelers. In order to detect four classes, need to prepare corresponding dataset and set four classes in training spec for training.
You aims to train a two classes model, right?
Your training dataset(9227 images) contains 29684 cars and only 1818 two-wheelers.
Could you train via
set the lr rate very small
(min_learning_rate: 5e-06
max_learning_rate: 5e-05 )
disable enable_autoweighting
set higher class weight (0.2) for two-wheelers class and lower class weight (0.01) for car class
My objective here is to add more custom annotated vehicle data to the exisiting pretrained model (Trafficcamnet) and try to increase its accuracy in detecting vehicles - car and two-wheelers (bicycle class).
How can i achieve this and train a model using the trafficcamnet as base and improve detection accuracy while retaining the detections provided by the pretrained model rather than training a new model with car and two-wheeler classes that might require huge amount of data for training.
No the dataset is not public, its a proprietary dataset. We have sliced frames from video recording of the area and then converted the images to 960x544 images and annotated them.
I added the pretrained model to the config file in the samples/config/tlt_pretrained_models/ and ran the model with the command : deepstream-app -c <deepstream_app_source1_trafficcamnet> and replaced the model paths to the custom trained model to check out its detections.
Also ran the command in the detectnetv2 notebook file for visulalising the inferences during the model training process :
I exported the unpruned model located in experiment_direxperiment_dir_unpruned/weights and changed the network mode to fp32 in config file and ran the application over video files. The below recordings are the results:
But my only concern is that why is the model not detecting cars as earlier pretrained model as I’m adding the cars to the same car class not a new one. I want to utilize the pretrained model features as it is already trained on over 1.2M images.
Should I start from the first step i.e creation of tfrecords then train the model, prune it and retrain it all with 10epoch for the test that you mentioned?
I’m using the trafficcamnet_pretrained_unpruned_v1.0 as the pretrained model in the specs file for train step? Is it correct or should I pruned model as a base?
But the only thing here is the minimum and max learning rate, should I set min_learning_rate: 10e-10 max_learning_rate: 10e-10 (or) min_learning_rate: 5e-06max_learning_rate: 5e-05 ?