Comments (6)
The 300x300 model has only two output channels.
from face_segmentation.
Does that mean the output should only be a 2x300x300 and not a 21x300x300? Then, in the following block of code from face_seg.py, are you simply taking the maximum of the two channels?
# run net and take argmax for prediction
net.forward()
out = net.blobs['score'].data[0].argmax(axis=0)
The end result must be a binary mask, but all of the outputs I'm seeing in the 21x300x300 array I get are float values, many of which are even negative. I'm wondering if the output of net.forward() may be different in the actual Caffe library and in openCV's readFromCaffe. I'm not sure though...
For reference, here is my code:
import numpy as np
import cv2
image = cv2.imread('Alison_Lohman_0001.jpg')
# Define prototext and caffemodel paths, and create model
caffeModel = "face_seg_fcn8s.caffemodel"
prototextPath = "face_seg_fcn8s_deploy.prototxt"
net = cv2.dnn.readNetFromCaffe(prototextPath,caffeModel)
# Resize to 300x300
image = cv2.resize(image,(300,300))
# blobImage convert RGB (104.00698793,116.66876762,122.67891434)
blob = cv2.dnn.blobFromImage(image,1.0,(300,300),(104.00698793,116.66876762,122.67891434))
# Passing blob through network
net.setInput(blob)
output = net.forward()
output is a 1x21x300x300 float32
from face_segmentation.
Ah I see what you mean about the 300x300 model. It produces a 1x2x300x300 output.
I'm still unsure of what to do with the two resulting images. After normalization, they look like this:
for the Alison_Lohman_0001.jpg image
from face_segmentation.
Did you find the answer to this? I'm trying to use it in openCV as well, same problems.
from face_segmentation.
@kiralygomba no unfortunately not.
from face_segmentation.
@kiralygomba looks like the only thing missing is the last operation:
mask=output[0].argmax(axis=0)
mask=1*(mask>0)
Though I must say it doesn't quite work as I thought
from face_segmentation.
Related Issues (20)
- No module surgery HOT 2
- Asking for training dataset HOT 2
- how to crop face bbox HOT 1
- cublas error. HOT 1
- Thanks for the great code and model HOT 1
- Network Output HOT 1
- can you offer training file HOT 6
- where is your U-Net models? HOT 2
- Could you release your database for face segmentation ? HOT 1
- CUDA CPU or GPU HOT 1
- Caffe Model to CoreML Model HOT 1
- driver_types.h error while installing HOT 1
- poor performance HOT 1
- Alpha mask
- Unable to segment eye-glasses HOT 1
- License for pre-trained model
- Installation
- PyTorch implementation HOT 3
- some questions in face_seg.py..... HOT 1
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 face_segmentation.