Giter VIP home page Giter VIP logo

object-detection-validation's Introduction

Implement validation of object detection models

Environments

Simply install requirements

pip install -r requirements.txt

Models

YOLO Format

Model in onnx format, with input is an image with pixel values from [0, 1], outputs with shape [batch_size, anchors, 4 + num_classes + 1]

Example 1 line in outputs is

# Format is [x_center, y_center, w, h, obj_conf, class_1_conf, class_2_conf]
[0.51 0.75 0.21 0.19 0.85 0.1 0.9]

Retina Format

Model in onnx format, with input is an image read from cv2.imread, 3 outputs are scores, bboxes and landmarks

Example 1 line in outputs is

# bboxes
[ 0.67413944  1.0143973  -1.1417826   0.16699778]
# scores
[9.9962950e-01 3.7046883e-04]
# landmarks

Prepare labels

Ground truth labels in yolo format [class_idx, x_center, y_center, w, h]

0 0.725000 0.287500 0.089394 0.070455

Predict labels also in yolo format, with confidence [class_idx, x_center, y_center, w, h, conf]

0 0.8927168528238932 0.9185009002685547 0.17276369730631513 0.13056144714355478 0.8909046649932861

Run

To get predict of model, modify path in predict.py and run

python predict.py --onnx ./weights/yolov5m_v0_0_1.onnx \
                  --image_dir ../__testset__/TCB-VJA-testset_1/all/images \
                  --save_txt ./output_labels \
                  --backend yolo \
                  --gpu

To get evaluation value such as mAP, run

python evaluate.py -gt ../__testset__/TCB-VJA-testset_1/all/labels \
                   -dr ./output_labels \
                   --image_dir ../__testset__/TCB-VJA-testset_1/all/images \
                   --num_classes 2

References

object-detection-validation's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.