JunweiLiang / Object_Detection_Tracking

Out-of-the-box code and models for CMU's object detection and tracking system for multi-camera surveillance videos. Speed optimized Faster-RCNN model. Tensorflow based. Also supports EfficientDet. WACVW'20
MIT License
479 stars 135 forks source link

Config file #34

Closed kevinyena closed 3 years ago

kevinyena commented 3 years ago

Hello ! Could you help me please ? I am looking for the config file you have used to train the model obj_v3.pb ! It may be pipeline.config , or faster_resnet_101_coco.config, or another file wich ended by ".config" and it starts by something like this:

Faster R-CNN with Resnet-101 (v1), configuration for MSCOCO Dataset.

Users should configure the fine_tune_checkpoint field in the train config as

well as the label_map_path and input_path fields in the train_input_reader and

eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that

should be configured.

model { faster_rcnn { num_classes: 90 image_resizer { keep_aspect_ratio_resizer { min_dimension: 600 max_dimension: 1024 } } feature_extractor { type: 'faster_rcnn_resnet101' first_stage_features_stride: 16 } first_stage_anchor_generator { grid_anchor_generator { scales: [0.25, 0.5, 1.0, 2.0] aspect_ratios: [0.5, 1.0, 2.0] height_stride: 16 width_stride: 16 } } first_stage_box_predictor_conv_hyperparams { op: CONV regularizer { l2_regularizer { weight: 0.0 } } initializer { truncated_normal_initializer { stddev: 0.01 } } } first_stage_nms_score_threshold: 0.0 first_stage_nms_iou_threshold: 0.7 first_stage_max_proposals: 300 first_stage_localization_loss_weight: 2.0 first_stage_objectness_loss_weight: 1.0 initial_crop_size: 14 maxpool_kernel_size: 2 maxpool_stride: 2 second_stage_box_predictor { mask_rcnn_box_predictor { use_dropout: false dropout_keep_probability: 1.0 fc_hyperparams { op: FC regularizer { l2_regularizer { weight: 0.0 } } initializer { variance_scaling_initializer { factor: 1.0 uniform: true mode: FAN_AVG } } } } } second_stage_post_processing { batch_non_max_suppression { score_threshold: 0.0 iou_threshold: 0.6 max_detections_per_class: 100 max_total_detections: 300 } score_converter: SOFTMAX } second_stage_localization_loss_weight: 2.0 second_stage_classification_loss_weight: 1.0 } }

train_config: { batch_size: 1 optimizer { momentum_optimizer: { learning_rate: { manual_step_learning_rate { initial_learning_rate: 0.0003 schedule { step: 900000 learning_rate: .00003 } schedule { step: 1200000 learning_rate: .000003 } } } momentum_optimizer_value: 0.9 } .....

Thank you for your help !!

JunweiLiang commented 3 years ago

Not sure what this is coming from. You can follow my instructions here to train obj_v3. READ THEM. There is no config file needed.

kevinyena commented 3 years ago

Thank you, but i need to have both .pb and .pbtxt beacause i want to use cv2.dnn during the inference. I should have something like that cv2.dnn.readNetFromTensorflow(obj_v3.pb, obj_v3_graph.pbtxt).

To have the graph.pbtxt i need the .config file. Do you have another way to get the graph.pbtxt using your files please ? i really need this file.

Thanks

JunweiLiang commented 3 years ago

Hi,

To do object detection and tracking inference, please follow the instructions here. This only needs .npz or .pb model files.

To get a .pbtxt file, you can modify the "pack" function in this code and follow instructions from here to export the model to .pb as well as .pbtxt.

kevinyena commented 3 years ago

Thank you, i followed your instructions but i have a problem when freezing the model with this command line:

python main.py nothing nothing --mode pack --pack_model_path obj_v3.pb \ --pack_modelconfig_path obj_v3.config.json --load_from obj_v3_model/ --note obj_v3 --num_class 15 \ --diva_class3 --rpn_batch_size 256 --frcnn_batch_size 512 --rpn_test_post_nms_topk 1000 --is_fpn \ --use_dilation --max_size 1920 --short_edge_size 1080

i can't find the obj_v3.config.json file. In wich folder could i find it please.

JunweiLiang commented 3 years ago

The config file is just a json to save the options you used to freeze the model (see here). I have updated the instructions. As I said, change the code yourself to get the "config" file you want.

kevinyena commented 3 years ago

Thank you !