Coder Social home page Coder Social logo

Two boxes, same points? about dlib-models HOT 4 CLOSED

davisking avatar davisking commented on June 8, 2024
Two boxes, same points?

from dlib-models.

Comments (4)

davisking avatar davisking commented on June 8, 2024 1

Yes this is the reason. The two sets of boxes come from dlib's two face detectors. Training on both of them causes the resulting model to work well for both face detectors, since as you noted, the landmarking model's predictions are seeded from the position of the bounding box. So boxes that are placed systematically different from how they appear in training data would result in worse performance. Since the two face detectors use slightly different box annotation schemes this would be a problem if the landmarking model wasn't trained to be aware of this.

from dlib-models.

davisking avatar davisking commented on June 8, 2024 1

from dlib-models.

realleyriley avatar realleyriley commented on June 8, 2024

After thinking about it just now, I think the two boxes might be for making the landmark predictor more robust. I ran the script below to find any boxes that had different landmark coordinates, but I found nothing. By using different boxes, the shape predictor can train itself to identify landmarks more generally. The landmark predictor takes in the bounding box as input, and by training it on different bounding boxes, we can expand the training set I believe.

import xml.etree.ElementTree as ET
root = ET.parse('train_cleaned.xml').getroot()`

for image in root.find('images').findall('image'):
    boxes = image.findall('box')    # find all boxes in this image
    if(len(boxes) < 1):
        print('no boxes? ', image.attrib)
    if(len(boxes) > 1):             # some images only have one box
        parts0 = [part.attrib for part in boxes[0].findall('part')]
        parts1 = [part.attrib for part in boxes[1].findall('part')]
        if(parts0 != parts1):
            print('unequal points ', image.attrib)

from dlib-models.

realleyriley avatar realleyriley commented on June 8, 2024

Thank you for responding, it makes sense.

Another question: why is there a black border on many of the pictures? And why are their dimensions square? I flipped through the first 50 and noticed many of them are 711x711 or 411x411 and a few other dimensions.
How will the black pixels affect the training, and the resulting model?

The training is done in the shape_predictor_trainer.h file, but I don't understand it well enough to answer my own question.

from dlib-models.

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.