-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,416 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cmake_minimum_required(VERSION 3.0.2) | ||
project(mnn_det) | ||
|
||
|
||
include_directories( | ||
include | ||
) | ||
|
||
find_package(OpenCV 4 REQUIRED) | ||
include_directories(${OpenCV_INCLUDE_DIRS}) | ||
|
||
include_directories(/usr/include/eigen3) | ||
|
||
# --------------modify your own mnn path--------------- | ||
include_directories(/home/lsh/code/mnn_dev/MNN/include) | ||
link_directories(/home/lsh/code/mnn_dev/MNN/build) | ||
# --------------modify your own mnn path--------------- | ||
|
||
|
||
add_executable(mnn_det | ||
src/demo.cpp | ||
) | ||
|
||
target_link_libraries(mnn_det ${OpenCV_LIBRARIES}) | ||
target_link_libraries(mnn_det MNN) | ||
target_link_libraries(mnn_det yaml-cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# MNN Deployment demo for EdgeYOLO | ||
|
||
## 1. install MNN Framework | ||
before using this framework, please install mnn SDK | ||
|
||
```bash | ||
git clone https://github.com/alibaba/MNN | ||
cd MNN | ||
./schema/generate.sh | ||
mkdir build && cd build | ||
cmake .. -DMNN_OPENCL=ON -DMNN_BUILD_CONVERTER=ON -DMNN_BUILD_TOOL=ON -DMNN_BUILD_QUANTOOLS=ON -DMNN_BUILD_OPENCV=ON | ||
make -j8 | ||
``` | ||
|
||
or just [**download here**](https://github.com/LSH9832/edgeyolo/releases/download/v1.0.1/mnn_dev.zip) to make sure you are using the same version with mine. | ||
```bash | ||
unzip mnn_dev.zip | ||
cd mnn_dev | ||
chmod +x ./setup.bash && ./setup.bash | ||
``` | ||
|
||
## 2. setup & model preparation | ||
|
||
- first, modify link_libraries of MNN in CMakeLists.txt | ||
- compile this demo | ||
|
||
```bash | ||
chmod +x setup.bash && ./setup.bash | ||
``` | ||
- convert your own mnn models and put it in "./models" | ||
|
||
```bash | ||
cd /path_to_your_MNN/build | ||
./MNNConvert -f ONNX --modelFile XXX.onnx --MNNModel xxx.mnn --fp16 | ||
``` | ||
or you can download converted [**coco model**](https://github.com/LSH9832/edgeyolo/releases/download/v1.0.1/edgeyolo_coco.mnn) and [**visdrone model**](https://github.com/LSH9832/edgeyolo/releases/download/v1.0.1/edgeyolo_visdrone.mnn) (tiny-lrelu) and put them in dir "./models" | ||
|
||
then modify **config/mnn_detection_xxx.yaml**: | ||
|
||
```yaml | ||
model: "/path_to_this_project/models/edgeyolo_coco.mnn" | ||
names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', | ||
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', | ||
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', | ||
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', | ||
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', | ||
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', | ||
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', | ||
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', | ||
'hair drier', 'toothbrush'] | ||
num_threads: 3 # number of threads while doing inference | ||
conf_thres: 0.25 | ||
nms_thres: 0.45 | ||
``` | ||
## 3. run edgeyolo with MNN | ||
```bash | ||
# example | ||
./build/mnn_det --cfg config/mnn_detection_coco \ # model config | ||
--video \ # or --device --picture | ||
--source /path_to_video_file.mp4 \ # or 0 for camera, or /path/to/image.jpg for picture | ||
--no-label # do not draw label | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
model: "models/edgeyolo_coco.mnn" | ||
names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', | ||
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', | ||
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', | ||
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', | ||
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', | ||
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', | ||
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', | ||
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', | ||
'hair drier', 'toothbrush'] | ||
num_threads: 3 | ||
conf_thres: 0.25 | ||
nms_thres: 0.45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model: "models/edgeyolo_visdrone.mnn" | ||
names: ['pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', 'awning-tricycle', 'bus', 'motor'] | ||
num_threads: 4 | ||
conf_thres: 0.25 | ||
nms_thres: 0.45 |
Oops, something went wrong.