Comments (4)
Hi, thank you for your feedback.
I tested your model with this script
import cv2
import argparse
import numpy as np
import onnxruntime
# main
parser=argparse.ArgumentParser()
parser.add_argument("-i", "--image", type=str, required=False, help="input image")
args=parser.parse_args()
caffeProto="face_seg_fcn8s_deploy.prototxt"
caffeModel="face_seg_fcn8s.caffemodel"
onnxModel="face_seg_fcn8s_deploy.onnx"
caffeNet=cv2.dnn.readNet(caffeModel, caffeProto)
onnxNet=cv2.dnn.readNetFromONNX(onnxModel)
MODEL_MEAN_VALUES=(0, 0, 0)
frame=cv2.imread(args.image if args.image else 'face.jpg')
# caffe net
blob=cv2.dnn.blobFromImage(frame, 1.0, (500,500), MODEL_MEAN_VALUES, swapRB=False)
caffeNet.setInput(blob)
caffeNetPreds=caffeNet.forward()
print(caffeNetPreds.shape)
# onnx net
session = onnxruntime.InferenceSession(onnxModel)
input_name = session.get_inputs()[0].name
img = np.transpose(frame, [2, 0, 1])
img = np.expand_dims(img, axis=0)
img = img.astype(np.float32)
onnxNetPreds = session.run(None, {input_name: img})[0]
print(onnxNetPreds.shape)
and got different shapes of outputs
(1, 21, 500, 500) # caffe net
(1, 3, 500, 500) # onnx net
I think that something wrong with prototxt file.
from caffe2onnx.
Also I noticed that the model is in caffe_v2 format. It is not compatible with caffe2onnx, converter works ONLY with caffe (version 1) models.
from caffe2onnx.
Hi @asiryan,
Thank you for your feedback.
from caffe2onnx.
Hi @asiryan ,
I am still trying to investigate/research what is the best way to convert my caffe model to ONNX, but I was hoping that I could clarify a few things please.
- From your experiment, I just wanted to find out what makes you think that there is something wrong with the prototxt file? I am using the pre-trained model from this repo (specially the one in the
face_seg_fcn8s.zip
file). - I have never worked with anything relating to caffe and just wanted to find out how were you able to tell that the model is in caffe_v2 format? The repo from which I am using the model states that Caffe (minimum version 1.0) can be used.
Any assistance would be highly appreciated.
Thanks
from caffe2onnx.
Related Issues (4)
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 caffe2onnx.