Ask Your Question

Revision history [back]

Full recipes:

python.exe ~ \site-packages\tensorflow\python\tools\optimize_for_inference.py  --input frozen_inference_graph_face.pb --output new_frozen_inference_graph_face.pb --input_names image_tensor --output_names "num_detections,detection_scores,detection_boxes,detection_classes"  --placeholder_type_enum 4 --frozen_graph

then read this issue : copy ssd_mobilenet_v1_coco.config where is your pb file and change :

number of classes from 90 to 2 and

    image_resizer {
      fixed_shape_resizer {
        height: 300
        width: 300
      }
    }

to

    image_resizer {
      fixed_shape_resizer {
        height: 512
        width: 512
      }
    }

copy tf_text_graph_ssd.py ( and tf_text_graph_common.py) iwhere is your pb file and change line 277 (opencv4.1.-dev 20190507)

re.match('BoxPredictor_\d/BoxEncodingPredictor/Conv2D', node.name)

in

re.match('BoxPredictor_\d/BoxEncodingPredictor/convolution', node.name)

and run

tf_text_graph_ssd.py --input new_frozen_inference_graph_face.pb --output new_frozen_inference_graph_face.pbtxt --config ssd_mobilenet_v1_coco.config