Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6517 Discussions

Training Extensions: how to change the output layer to have confidence score?

Je6
Beginner
1,148 Views

Hi, I'm working on OpenVINO training extensions to train object detection model with custom dataset.

 

I successfully trained model but I found the output layer only includes boxes and labels.

Je6_0-1709157130013.png

I need confidence score to implement my application.

 

Before trying to use custom model, I used ssdlite_mobilenet_v2. And this model's output is  DetectionOutput (each detection has the format: [image_id, label, conf, x_min, y_min, x_max, y_max]). 

I wonder why the default structure for object detection(in openvino training extensions) model doesn't have a confidence score.

 

I've searching related documents and code but haven't found answer..

How can I change this structure to include confidence score?

 

Thanks.

0 Kudos
6 Replies
Hairul_Intel
Moderator
1,123 Views

Hi Je6,

Thank you for reaching out to us.

 

Please provide the following information for further investigation from our side:

  • System information (CPU, GPU, OS, Python version, etc.)
  • Installation guide that you've followed for the OpenVINO Training Extension.
  • Commands used to generate the custom model.

 

 

Regards,

Hairul


0 Kudos
Je6
Beginner
1,105 Views

Hi,

Thank you for responding.

 

I tried to train models using Semi-Supervised Learning.

  • System Information: Dell XPS 15 9520
    • CPU: 12th Gen Intel(R) Core(TM) i7-12700H
    • GPU: GeForce RTX 3050 Ti Mobile, iGPU
    • OS: Ubuntu 22.04.2 LTS 6.5.0-14-generic
    • Python version(in venv): 3.10.12
  • I followed "Install OpenVINO™ Training Extensions for users" in this doc. Also tried "Install OpenVINO™ Training Extensions for developers".
  • Commands:

 

 

$ source .otx/bin/activate
$ otx build Custom_Object_Detection_Gen3_ATSS --train-data-roots ../dataset/person/semisl/coco_format/ --unlabeled-data-roots ../dataset/person/semisl/unlabeled/
$ cd otx-workspace-DETECTION
$ otx train --output outputs/ params --learning_parameters.learning_rate 0.004 
$ otx eval --test-data-roots splitted_dataset/val --load-weights outputs/models/weights.pth --output outputs/
$ otx export --load-weights outputs/models/weights.pth --output outputs/openvino/

 

 

So do I need to use the developer version of training extensions? Dose that have more functions? I only see that when I use that one, I can change the code. To resolve the issue I have, should I change the code?

 

 

Regards,

 

0 Kudos
Hairul_Intel
Moderator
1,086 Views

Hi Je6,

Thank you for providing the information.

 

We're investigating this issue and will update you on any findings as soon as possible.

 

 

Regards,

Hairul


0 Kudos
Hairul_Intel
Moderator
1,002 Views

Hi Je6,

Thank you for your patience.

 

Referencing this person-vehicle-bike-detection-2004 model that is based on MobileNetV2 backbone with ATSS head, the "boxes" blob has the following format [x_min, y_min, x_max, y_max, conf].

 

Here is a code snippet from Object Detection Sample SSD that shows the steps in extracting the confidence score from "boxes" output blob:

boxes.png

 

In summary, our converted model has already include the "confidence" values inside of the "boxes" blob in the format of [x_min, y_min, x_max, y_max, conf].

 

Hope this helps.

 

 

Regards,

Hairul

 

0 Kudos
Je6
Beginner
968 Views

Hi,

Yes I realized that there is one more output that indicates labels.

So the structure is:

<bound method PyCapsule.output of <CompiledModel:
inputs[
<ConstOutput: names[image] shape[1,3,736,992] type: f32>
]
outputs[
<ConstOutput: names[boxes] shape[1,200,5] type: f32>,
<ConstOutput: names[labels] shape[1,200] type: i64>
]>>

And in "boxes", there is a confidence score.

 

Thank you so much for your explanations and response!

 

Regards,

0 Kudos
Hairul_Intel
Moderator
923 Views

Hi Je6,

Glad to be of help.

 

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Hairul


0 Kudos
Reply