Coder Social home page Coder Social logo

Comments (5)

fengyuentau avatar fengyuentau commented on June 16, 2024

@Wwupup Please take a look.

from libfacedetection.train.

Wwupup avatar Wwupup commented on June 16, 2024

Hello, I just tested this model and found no problems you said. Please confirm whether the input size is scaled to 320x320. My test code is as follows:
python tools/compare_inference.py ./onnx/yunet_yunet_final_320_320_simplify.onnx --image test.jpg --mode 320,320

from libfacedetection.train.

enemy1205 avatar enemy1205 commented on June 16, 2024

However,according to this code

class PriorBox(object):
    def __init__(self, min_sizes, steps, clip, ratio):
        super(PriorBox, self).__init__()
        self.min_sizes = min_sizes
        self.steps = steps
        self.clip = clip
        self.ratio = ratio
    def __call__(self, image_size):
        # given 320
        
        feature_map_2th = [int(int((image_size[0] + 1) / 2) / 2),
                                int(int((image_size[1] + 1) / 2) / 2)]
        # 2th 80
        feature_map_3th = [int(feature_map_2th[0] / 2),
                                int(feature_map_2th[1] / 2)]
        # 3th 40
        feature_map_4th = [int(feature_map_3th[0] / 2),
                                int(feature_map_3th[1] / 2)]
        # 4th 20
        feature_map_5th = [int(feature_map_4th[0] / 2),
                                int(feature_map_4th[1] / 2)]
        # 5th 10
        feature_map_6th = [int(feature_map_5th[0] / 2),
                                int(feature_map_5th[1] / 2)]
        # 6th 5

        feature_maps = [feature_map_3th, feature_map_4th,
                             feature_map_5th, feature_map_6th]
        anchors = []
        for k, f in enumerate(feature_maps):
            min_sizes = self.min_sizes[k]
            for i, j in product(range(f[0]), range(f[1])):
                for min_size in min_sizes:
                    cx = (j + 0.5) * self.steps[k] / image_size[1]
                    cy = (i + 0.5) * self.steps[k] / image_size[0]
                    for r in self.ratio:
                        s_ky = min_size / image_size[0]
                        s_kx = r * min_size / image_size[1]
                        anchors += [cx, cy, s_kx, s_ky]
        # back to torch land
        output = torch.Tensor(anchors).view(-1, 4)
        if self.clip:
            output.clamp_(max=1, min=0)
        return output

feature_maps will be [40,20,10,5]
As min_sizes: [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]]
And 40x40+20x20+10x10+5x5=2125 ,but the number of priors in output of the onnx model is 5875, it's not divisible by 2125('x' stands for multiplication as pairs of '*' are recognized by markdown as italics)
I can't understand this thought I know your code should be fine。

from libfacedetection.train.

Wwupup avatar Wwupup commented on June 16, 2024

Hello,
As feature_maps=[40, 20, 10, 5] with min_sizes: [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]],
the anchor_num=40x40x3 + 20x20x2 + 10x10x2 + 5x5x3 = 5875

from libfacedetection.train.

enemy1205 avatar enemy1205 commented on June 16, 2024

Thanks for reply , since I'm rewriting the C++ version of inference in TensorRT, I may not be familiar with this kind of multiple traversal.

from libfacedetection.train.

Related Issues (20)

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.