Comments (2)
The issue you're facing with the bounding box coordinates, where the height and width of the boxes are larger than the actual face and sometimes vary randomly, might be due to the difference in the input image sizes between MTCNN and the face recognition model.
MTCNN expects the input image size to be relatively small (typically a few hundred pixels), while the face recognition model may require a larger input image size (e.g., 160x160 pixels) for accurate feature extraction. When you extract the face region using the bounding box coordinates from MTCNN, it may result in a face image that doesn't match the size expectation of the face recognition model.
To resolve this issue, you need to ensure that the face region extracted from MTCNN is resized to match the input size required by the face recognition model. You can use OpenCV's resize function or other image resizing methods to resize the face region before feeding it into the face recognition model.
I hope this will solve the issue. If you need any more help feel free to reply.
from facenet.
I am facing the same issue. I am detecting the faces and saving the cropped face image on local drive to further train a facial recognition model. But the bounding box is only accurate on top left corner. Other corners are expanded. Below is my code:
`
from facenet_pytorch import MTCNN
import cv2
import os
mtcnn = MTCNN(keep_all=True, device='cuda:0')
dir_path = 'assets/raw/ammar'
save_path = 'assets/face_raw/ammar'
files = os.listdir(dir_path)
for file in files:
img = cv2.imread(dir_path+"/"+file, cv2.COLOR_BGR2RGB)
boxes, _ = mtcnn.detect(img)
x = int(boxes[0][0])
y = int(boxes[0][1])
w = int(boxes[0][2])
h = int(boxes[0][3])
crop_img = img[y:y+h, x:x+w]
cv2.imwrite(save_path+"/"+file, crop_img)
`
I'm stuck here and cannot find a solution.
from facenet.
Related Issues (20)
- error Found array with 0 sample(s) (shape=(0, 512)) while a minimum of 1 is required HOT 1
- command not found error (while trying align the LFW dataset)
- ValueError: Node 'gradients/InceptionResnetV1/Bottleneck/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad' has an _output_shapes attribute inconsistent with the GraphDef for output #3: Dimension 0 in both shapes must be equal, but are 0 and 512. Shapes are [0] and [512]. HOT 4
- TypeError: true_fn and false_fn arguments to tf.cond must have the same number, type, and overall structure of return values
- does facenet support docker HOT 1
- About tensorflow -v2.8.0, I have a error. HOT 1
- Validation loss
- ve
- How to make inference on a single image? HOT 1
- Error in Loading checkpoint file for facenet512
- Unable to open file (file signature not found) HOT 1
- CASIA Webface Dataset Link Needs Updating
- Incorrect bounding box
- Issue with Tensor Names in DeepSORT Integration with FaceNET Model
- Unable to use .pb in tensorflow's java api
- Unable to convert onnx model to TRT model
- ValueError: Node 'gradients/InceptionResnetV1/Bottleneck/BatchNorm/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad' has an _output_shapes attribute inconsistent with the GraphDef for output #3: Dimension 0 in both shapes must be equal, but are 0 and 512. Shapes are [0] and [512]. HOT 1
- Request for Weight Files in faceswap-GAN Project
- How to add visualization to train_tripletloss.py
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facenet.