hollance / blazeface-pytorch Goto Github PK
View Code? Open in Web Editor NEWThe BlazeFace face detector model implemented in PyTorch
License: Other
The BlazeFace face detector model implemented in PyTorch
License: Other
Will training process opensource for BlazeFace?
hi,
I load the anchorsback.npy and the anchors.npy and print them,
find the anchors are same.
is it right??
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'
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.
Hello. Thanks for your work.
I see that there is still a blazeface_back model at https://github.com/google/mediapipe/blob/master/mediapipe/models/face_detection_back.tflite, how should i implement ?
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?
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
BlazeFace-PyTorch/blazeface.py
Line 450 in 852bfd8
I may be reading it wrong, but are the lines used to calculate max_xy
using the box dimensions, when they should be using the boxes max x/y coordinates?
A box is defined as [min_x, min_y, dim_x, dim_y]
, is it not?
I'm a beginner. I want to ask:How to use the blazeface.pth?
There seems to be some issue, that this doesn't load, others are loading.
I saw the RAW content of this ipynb and saw few images in it - not sure whether they are the cause.
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.
Thank you for your work. I could not find testing code. Could you please advice? Thank you.
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)
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 ?
:-)
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?
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.