retinaface-tvm's People
Forkers
tianxingyzxq tsec qqq-tech dexception qaz734913414 gsbyeon kurnianggoro jayle19930918 cavalleria nuanxinqing xiaotie1005 schliffen dineshkumares pqmsoft1 least1924retinaface-tvm's Issues
resolved
resolved.
TVM model
HI, Howave
This is a great work. I have a liite confuse about where did you get your mxnet model? could you please add a link? Since I am using MacOS, I have to convert it on my own env.
Thanks
How to forward in batches
Thank you for your work! I have some problems about batch forward.
-In from_mxnet.py, batch_size=1, input_shape=(1, 3, H, W), then the models for TVM are produced
-When inferring with TVM, the input_shape must be (1, 3, H, W)
-How to batch forward with TVM ?
build, run successed.. but result not correct
Hi, I have successfully completed the build and run.
The problem is that the results are not correct..
I converted the model at https://github.com/Charrin/RetinaFace-Cpp/blob/master/convert_models/mnet/mnet.25-symbol.json
A warning appears when running from_mxnet.py
[13:57:08] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.3.0. Attempting to upgrade...
[13:57:08] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 3, 640, 480), 'float32'), ('TENSOR', (8, 3, 3, 3), 'float32'), (2, 2), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 8, 320, 240), 'float32'), ('TENSOR', (8, 1, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 8, 320, 240), 'float32'), ('TENSOR', (16, 8, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 16, 320, 240), 'float32'), ('TENSOR', (16, 1, 3, 3), 'float32'), (2, 2), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 16, 160, 120), 'float32'), ('TENSOR', (32, 16, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 32, 160, 120), 'float32'), ('TENSOR', (32, 1, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 32, 160, 120), 'float32'), ('TENSOR', (32, 32, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 32, 160, 120), 'float32'), ('TENSOR', (32, 1, 3, 3), 'float32'), (2, 2), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 32, 80, 60), 'float32'), ('TENSOR', (64, 32, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (64, 1, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (64, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (64, 1, 3, 3), 'float32'), (2, 2), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (128, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 128, 40, 30), 'float32'), ('TENSOR', (128, 1, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 128, 40, 30), 'float32'), ('TENSOR', (128, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 128, 40, 30), 'float32'), ('TENSOR', (128, 1, 3, 3), 'float32'), (2, 2), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 128, 20, 15), 'float32'), ('TENSOR', (256, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('depthwise_conv2d_NCHWc.x86', ('TENSOR', (1, 256, 20, 15), 'float32'), ('TENSOR', (256, 1, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 256, 20, 15), 'float32'), ('TENSOR', (256, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 256, 20, 15), 'float32'), ('TENSOR', (64, 256, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 20, 15), 'float32'), ('TENSOR', (32, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 20, 15), 'float32'), ('TENSOR', (16, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 16, 20, 15), 'float32'), ('TENSOR', (16, 16, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 20, 15), 'float32'), ('TENSOR', (4, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 20, 15), 'float32'), ('TENSOR', (8, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 20, 15), 'float32'), ('TENSOR', (20, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 128, 40, 30), 'float32'), ('TENSOR', (64, 128, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (32, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (16, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 16, 40, 30), 'float32'), ('TENSOR', (16, 16, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (4, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (8, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 40, 30), 'float32'), ('TENSOR', (20, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (64, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (32, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (16, 64, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 16, 80, 60), 'float32'), ('TENSOR', (16, 16, 3, 3), 'float32'), (1, 1), (1, 1, 1, 1), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (4, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (8, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Cannot find config for target=llvm, workload=('conv2d_NCHWc.x86', ('TENSOR', (1, 64, 80, 60), 'float32'), ('TENSOR', (20, 64, 1, 1), 'float32'), (1, 1), (0, 0, 0, 0), (1, 1), 'NCHW', 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Compile...
------convert done!!!------
Process finished with exit code 0
But the model is saved normally.
after build,The result of running retinaface_ncnn
Pre Forward Time: 10.3058ms
proposals:133
proposals:371
proposals:1479
Forward Time: 65.0252ms
Post Forward Time: 0.593445ms
All Time: 75.9244ms
final proposals: 92
score0: 1.000000
score1: 1.000000
score2: 1.000000
score3: 1.000000
score4: 1.000000
score5: 1.000000
score6: 1.000000
score7: 1.000000
score8: 1.000000
score9: 1.000000
score10: 1.000000
score11: 1.000000
.
.
.
What is the problem?
The converted model you attached is correct..
My environment
Ubuntu 19.10
TVM 0.7.dev1
llvm 6.0
Why 480x640?
The image shape of Retina face is :640x480, the aspect ratio is same with normal camera, but in your source code, it is 480x640, is it really correct? thank you
build successed, but run failed.
Thanks your wonderful works, I build your project successfully, but I got this error when I run the bin file, can you help me to solve the problem?
terminate called after throwing an instance of 'dmlc::Error'
what(): [09:18:21] /***/tvm/src/runtime/dso_module.cc:112: Check failed: lib_handle_ != nullptr: Failed to load dynamic shared library ./models/480P/mnet.25.x86.cpu.so /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by ./models/480P/mnet.25.x86.cpu.so)
Stack trace:
[bt] (0) /usr/local/lib/libtvm_runtime.so(+0x5104f) [0x7f788f53804f]
[bt] (1) /usr/local/lib/libtvm_runtime.so(tvm::runtime::Module::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)+0x52c) [0x7f788f50e7ec]
[bt] (2) ./bin/retinaface_tvm(+0x4adb) [0x556739214adb]
[bt] (3) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f788e89c830]
[bt] (4) ./bin/retinaface_tvm(+0x7499) [0x556739217499]
Aborted (core dumped)
detection speeds too much time
Thank you for your work! I compiled the model using TVM at Windows10 successfully and got the correct bouding box of face. But it needs 1200ms to detect one frame which is so strange. I do no know what is the problem.
Python inference
import numpy as np
import nnvm.compiler
import nnvm.testing
import tvm
from tvm.contrib import graph_runtime
import mxnet as mx
import cv2
from mxnet import ndarray as nd
ctx = tvm.cpu()
data_shape = (640, 480, 3)
loaded_json = open("./models/480P/mnet.25.x86.cpu.json").read()
loaded_lib = tvm.module.load("./models/480P/mnet.25.x86.cpu.so")
loaded_params = bytearray(open("./models/480P/mnet.25.x86.cpu.params", "rb").read())
module = graph_runtime.create(loaded_json, loaded_lib, ctx)
module.load_params(loaded_params)
img = cv2.imread('/home/xyz/desktop/7.jpg')
resized = cv2.resize(img, (480, 640))
input_data = tvm.nd.array(resized.astype("float32"))
module.run(data=input_data)
ret = module.get_output(0).asnumpy()
I am not aware of the output shape and the way to fetch rest of the results. Can you be kind enough to help with rest of the code ?
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.