Skip to content

I am trying to use the code you provided, but I have some questions... #5

@Bahramudin

Description

@Bahramudin

First of all thanks for this effort!!

Secondly, I have am trying to train my own image dataset with Tensorflow, I have already done according to the README file (prepared images for 2 objects each 200, and run the train.sh commands and everything go well), it has created a folder calls tf_file and one inception.

The question is that, then how can I use the trained data in OpenCV for detecting the objects?
for example, the OpenCV DNN module support Tensorflow, when I use the ssd_mobilenet_v1_coco_11_06_2017 trained data OpenCV needs two files:

  1. frozen_inference_graph.pb
  2. ssd_mobilenet_v1_coco.pbtxt

which can be something like this:

String basePath = "D:\\ssd_mobilenet_v1_coco_11_06_2017\\";
String model = basePath + "frozen_inference_graph.pb";
String config = basePath + "ssd_mobilenet_v1_coco.pbtxt";
Net net = Dnn.readNetFromTensorflow(model, config);

And then I am able to detect the objects.

Now how can I get this result by training my own dataset?

When I use the .pb file in OpenCV it says:

OpenCV Error: Unspecified error (Unknown layer type DecodeJpeg in op DecodeJpeg) in cv::dnn::experimental_dnn_v3::anonymous-namespace'::TFImporter::populateNet, file C:\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 1487 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: E:\git_folder\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:1487: error: (-2) Unknown layer type DecodeJpeg in op DecodeJpeg in function cv::dnn::experimental_dnn_v3::anonymous-namespace'::TFImporter::populateNet
]
at org.opencv.dnn.Dnn.readNetFromTensorflow_1(Native Method)
at org.opencv.dnn.Dnn.readNetFromTensorflow(Dnn.java:162)

Thanks in Advance!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions