Git Product home page Git Product logo

blazeface-pytorch's Introduction

Hi there ๐Ÿ‘‹

I'm an audio software developer, working on my own plug-ins as well as freelance for other audio companies.

Most recently I've been employed as a machine learning engineer and as an iOS developer. These days I mostly write C++ audio code. I've been professionally active as a software developer since the mid 1990s.

I have also written and co-written a number of books (most notably The iOS Apprentice and Core ML Survival Guide) and have published my own apps and games as an indie developer.

blazeface-pytorch's People

Contributors

hollance avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blazeface-pytorch's Issues

how to use regressor

weighted = (coordinates * scores).sum(dim=0) / total_score

coordinates * scores error:
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 1

infinite loop in _weighted_non_max_suppression

the loop

        while len(remaining) > 0:
            detection = detections[remaining[0]]

            # Compute the overlap between the first box and the other 
            # remaining boxes. (Note that the other_boxes also include
            # the first_box.)
            first_box = detection[:4]
            other_boxes = detections[remaining, :4]
            ious = overlap_similarity(first_box, other_boxes)

            # If two detections don't overlap enough, they are considered
            # to be from different faces.
            mask = ious > self.min_suppression_threshold
            overlapping = remaining[mask]
            remaining = remaining[~mask]

            # Take an average of the coordinates from the overlapping
            # detections, weighted by their confidence scores.
            weighted_detection = detection.clone()
            if len(overlapping) > 1:
                coordinates = detections[overlapping, :16]
                scores = detections[overlapping, 16:17]
                total_score = scores.sum()
                weighted = (coordinates * scores).sum(dim=0) / total_score
                weighted_detection[:16] = weighted
                weighted_detection[16] = total_score / len(overlapping)

            output_detections.append(weighted_detection)

is infinite if len(remaining) == 1. I faced this when remaining = tensor([1]). Should it not be while len(remaining) > 1. Note this case occured when i set the min_score and min_suppression thresholds to 0.172, 0.104 respectively (if thats of any use)

testing code?

Thank you for your work. I could not find testing code. Could you please advice? Thank you.

Getting error - 'BlazeFace' object has no attribute 'load_weights'

Hello,

I am unable to load weights.

net.load_weights("blazeface.pth")

I am getting the below error.

---------------------------------------------------------------------------
ModuleAttributeError                      Traceback (most recent call last)
<ipython-input-29-cdf78203f6d0> in <module>
----> 1 net.load_weights("blazeface.pth")
      2 net.load_anchors("anchors.npy")
      3 
      4 # Optionally change the thresholds:
      5 net.min_score_thresh = 0.75

~/plaground/virtualenv/awslocal/lib/python3.7/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
    770                 return modules[name]
    771         raise ModuleAttributeError("'{}' object has no attribute '{}'".format(
--> 772             type(self).__name__, name))
    773 
    774     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

ModuleAttributeError: 'BlazeFace' object has no attribute 'load_weights'

bit exact?

Hello,
Thanks to share this great job !
Just a question by curiosity: did you test that converted pytorch version provides similar results as the original TFLite one ?
:-)

Any thoughts about making a port to PyTorch Mobile?

Hi! I'm currently starting some research about using face-detection models in limited compute devices such as smartphones (specifically I'm focusing on PyTorch Mobile) and my goal is to replicate the same app that Mediapipe did on Android but using your implementation of BlazeFace on PyTorch instead of TFLite.

Is this feasible?

If three ara any pytorch problem?

In Inference.ipynb In[5], """net.load_weights("blazeface.pth")""" goes wrong.I check the source code,torch receive a file object but not a string object,and I change just like:
"""
f = open("blazeface.pth", 'rb')
net.load_weights(f)
""".
After change, it can work properly.

Inference.ipynb Doesn't load

There seems to be some issue, that this doesn't load, others are loading.

  1. I saw the RAW content of this ipynb and saw few images in it - not sure whether they are the cause.

  2. I had few questions which this code might have answered but I am not able to figure them out.
    a. the input to this network is 128x128 - I saw your comment in the raw code where it says we have to resize, if an image is available as 320x240 if we resize at will - the faces will be squashed - does the detector work with this or does it expect aspect ratios to be maintained.

b. How is the inference done after the concantenation layer, which produces a 1x896x1 output. What kind of detector is used?

c. You have experience with converting weights from tensorflow lite to pytorch. I have a requirement to transfer a model from pytorch to tensorflow lite, can you point me to a starter guide for this.

Depth/xyz coordinates

Does you conversion output the depth values of the xy image coordinates that is traditionally in the blazepose/blazeface models? Have you ever converted the full blazepose (full body landmark) models to pytorch? If not what modifications would need to be made to your conversion script if any?

Max vs Min issue

Thanks very much for making this available.

I've been reading the code, and I think there might be a typo here: https://github.com/hollance/BlazeFace-PyTorch/blob/master/blazeface.py#L370

    max_xy = torch.min(box_a[:, 2:].unsqueeze(1).expand(A, B, 2),
                       box_b[:, 2:].unsqueeze(0).expand(A, B, 2))
    min_xy = torch.max(box_a[:, :2].unsqueeze(1).expand(A, B, 2),
                       box_b[:, :2].unsqueeze(0).expand(A, B, 2))

max_xy and min_xy are just reversed, right? Or am I missing something much smarter than me?

I don't think it affects anything either way though?

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.