Coder Social home page Coder Social logo

Comments (13)

liminghu avatar liminghu commented on July 21, 2024

@FeiGeChuanShu @hylrh2008 Are the steps at:
https://github.com/Megvii-BaseDetection/YOLOX/tree/main/demo/ncnn/cpp
enough?

from ncnn-android-yolox.

FeiGeChuanShu avatar FeiGeChuanShu commented on July 21, 2024

@FeiGeChuanShu @hylrh2008 Are the steps at:
https://github.com/Megvii-BaseDetection/YOLOX/tree/main/demo/ncnn/cpp
enough?

yes, follow these steps you can convert your yolox model to a ncnn model. then replace the model file and change the postprocess in this android demo code.

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

@FeiGeChuanShu Thanks a lot. so if the custom trained yolox has different number of classes and names, we just need to replace:
https://github.com/FeiGeChuanShu/ncnn-android-yolox/blob/f0acf18f23899bf58b113a162530a24ef72011ef/app/src/main/jni/yolox.cpp

line: 409 with the corresponding new class names?

from ncnn-android-yolox.

FeiGeChuanShu avatar FeiGeChuanShu commented on July 21, 2024

@FeiGeChuanShu Thanks a lot. so if the custom trained yolox has different number of classes and names, we just need to replace:
https://github.com/FeiGeChuanShu/ncnn-android-yolox/blob/f0acf18f23899bf58b113a162530a24ef72011ef/app/src/main/jni/yolox.cpp

line: 409 with the corresponding new class names?

yes

from ncnn-android-yolox.

bharath5673 avatar bharath5673 commented on July 21, 2024

can we get the app link?

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

I tried it, I got an error while transform *.pth to *.onnx model:
image

image

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

The issue is with onnxsim:
from onnxsim import simplify

# use onnxsimplify to reduce reduent model.
onnx_model = onnx.load(args.output_name)
model_simp, check = simplify(onnx_model)

if we add:
--no-onnxsim

then no issue at all.

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

One more question, if the *.param is:
7767517
310 346
Input images 0 1 images
Split splitncnn_input0 1 4 images images_splitncnn_0 images_splitncnn_1 images_splitncnn_2 images_splitncnn_3
MemoryData 1156 0 1 1156 0=1
MemoryData 1164 0 1 1164 0=1
MemoryData 1172 0 1 1172 0=1
Crop Slice_4 1 1 images_splitncnn_3 647 -23309=1,0 -23310=1,2147483647 -23311=1,1
Crop Slice_9 1 1 647 652 -23309=1,0 -23310=1,2147483647 -23311=1,2
Crop Slice_14 1 1 images_splitncnn_2 657 -23309=1,0 -23310=1,2147483647 -23311=1,1
Crop Slice_19 1 1 657 662 -23309=1,1 -23310=1,2147483647 -23311=1,2
Crop Slice_24 1 1 images_splitncnn_1 667 -23309=1,1 -23310=1,2147483647 -23311=1,1
Crop Slice_29 1 1 667 672 -23309=1,0 -23310=1,2147483647 -23311=1,2
Crop Slice_34 1 1 images_splitncnn_0 677 -23309=1,1 -23310=1,2147483647 -23311=1,1
Crop Slice_39 1 1 677 682 -23309=1,1 -23310=1,2147483647 -23311=1,2
Concat Concat_40 4 1 652 672 662 682 683 0=0
Convolution Conv_41 1 1 683 1177 0=16 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 15=1 16=1 5=1 6=1728
Swish Mul_43 1 1 1177 687

How to manually modify it?
Thanks a lot.

from ncnn-android-yolox.

FeiGeChuanShu avatar FeiGeChuanShu commented on July 21, 2024

One more question, if the *.param is:
7767517
310 346
Input images 0 1 images
Split splitncnn_input0 1 4 images images_splitncnn_0 images_splitncnn_1 images_splitncnn_2 images_splitncnn_3
MemoryData 1156 0 1 1156 0=1
MemoryData 1164 0 1 1164 0=1
MemoryData 1172 0 1 1172 0=1
Crop Slice_4 1 1 images_splitncnn_3 647 -23309=1,0 -23310=1,2147483647 -23311=1,1
Crop Slice_9 1 1 647 652 -23309=1,0 -23310=1,2147483647 -23311=1,2
Crop Slice_14 1 1 images_splitncnn_2 657 -23309=1,0 -23310=1,2147483647 -23311=1,1
Crop Slice_19 1 1 657 662 -23309=1,1 -23310=1,2147483647 -23311=1,2
Crop Slice_24 1 1 images_splitncnn_1 667 -23309=1,1 -23310=1,2147483647 -23311=1,1
Crop Slice_29 1 1 667 672 -23309=1,0 -23310=1,2147483647 -23311=1,2
Crop Slice_34 1 1 images_splitncnn_0 677 -23309=1,1 -23310=1,2147483647 -23311=1,1
Crop Slice_39 1 1 677 682 -23309=1,1 -23310=1,2147483647 -23311=1,2
Concat Concat_40 4 1 652 672 662 682 683 0=0
Convolution Conv_41 1 1 683 1177 0=16 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 15=1 16=1 5=1 6=1728
Swish Mul_43 1 1 1177 687

How to manually modify it?
Thanks a lot.

https://zhuanlan.zhihu.com/p/391788686 refer this url

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

@FeiGeChuanShu Thanks a lot.
So for my above *.param, I should modify it as:
7767517
301 346
Input images 0 1 images
MemoryData 1156 0 1 1156 0=1
MemoryData 1164 0 1 1164 0=1
MemoryData 1172 0 1 1172 0=1
YoloV5Focus focus 1 1 images 683
Convolution Conv_41 1 1 683 1177 0=16 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 15=1 16=1 5=1 6=1728
Swish Mul_43 1 1 1177 687

Shall I keep the 3 lines of 'MemoryData'?

from ncnn-android-yolox.

FeiGeChuanShu avatar FeiGeChuanShu commented on July 21, 2024

@FeiGeChuanShu Thanks a lot.
So for my above *.param, I should modify it as:
7767517
301 346
Input images 0 1 images
MemoryData 1156 0 1 1156 0=1
MemoryData 1164 0 1 1164 0=1
MemoryData 1172 0 1 1172 0=1
YoloV5Focus focus 1 1 images 683
Convolution Conv_41 1 1 683 1177 0=16 1=3 11=3 2=1 12=1 3=1 13=1 4=1 14=1 15=1 16=1 5=1 6=1728
Swish Mul_43 1 1 1177 687

Shall I keep the 3 lines of 'MemoryData'?

i don‘s know why your model have these ops,could you show me your onnx?

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

@FeiGeChuanShu I am trying to attach it, but the system is not allowed.
According to: https://zhuanlan.zhihu.com/p/391788686

请教一下,我转出来的param多出了MemoryData这三行:
Input images 0 1 images
Split splitncnn_input0 1 4 images images_splitncnn_0 images_splitncnn_1 images_splitncnn_2 images_splitncnn_3
MemoryData 1156 0 1 1156 0=1
MemoryData 1164 0 1 1164 0=1
MemoryData 1172 0 1 1172 0=1

按照步骤删去crop之后优化模型也顺利,看不出什么问题。但是跑ncnn demo代码时,就提示layer Shape not exists or registered。怎么回事呢

需要用onnx-simplifier把这些层给去掉之后再改focus

When I use export_onnx.py to generate *.onnx, I disabled:
--no-onnxsim
When I enabled onnixsim, then I got the error message as shown before.
I also tried:
https://github.com/daquexian/onnx-simplifier

I got the exact same error message.

Thanks a lot.

from ncnn-android-yolox.

liminghu avatar liminghu commented on July 21, 2024

I figured it out it is a version issue, we have to use:
image

otherwise, it will not work.

from ncnn-android-yolox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.