未验证 提交 7bc9b8b0 编写于 作者: Z zjd1988 提交者: GitHub

add yolov4-tiny README and modify yolov4-tiny codes (#445)

* modify src and test codes for yolov4
上级 81333494
......@@ -212,6 +212,35 @@ left = 205,right = 576,top = 153,bot = 447
![](https://s1.ax1x.com/2020/08/28/domYCt.jpg)
## yolov4-tiny目标检测任务 - [tm_yolov4_tiny.cpp](tm_yolov4_tiny.cpp)
使用图片:
![](https://github.com/OAID/Tengine/blob/master/tests/images/ssd_dog.jpg)
```bash
$ export LD_LIBRARY_PATH=./build/install/lib
$ ./build/install/bin/tm_yolov4_tiny -m models/yolov4_tiny.tmfile -i images/ssd_dog.jpg -r 1 -t 1
```
结果如下:
```bash
start to run register cpu allocator
tengine-lite library version: 1.0-dev
Repeat 1 times, thread 1, avg time 177.72 ms, max_time 177.72 ms, min_time 177.72 ms
--------------------------------------
num_detections,10
16: 74%
left = 125,right = 327,top = 221,bot = 537
2: 40%
7: 84%
left = 455,right = 703,top = 77,bot = 168
1: 28%
left = 56,right = 603,top = 85,bot = 496
```
![](https://s1.ax1x.com/2020/10/19/0zpvfU.jpg)
## 人体姿态识别任务 - [tm_openpose.cpp](tm_openpose.cpp)
使用图片:
......
......@@ -230,7 +230,7 @@ int yolo_num_detections(layer l, float thresh)
int obj_index = entry_index(l, b, n * l.w * l.h + i, 4);
if (l.output[obj_index] > thresh)
{
printf(".....%d -- %f\n",obj_index, l.output[obj_index]);
// printf(".....%d -- %f\n",obj_index, l.output[obj_index]);
++count;
}
}
......@@ -277,16 +277,8 @@ void correct_yolo_boxes(detection* dets, int n, int w, int h, int netw, int neth
int i;
int new_w = 0;
int new_h = 0;
if ((( float )netw / w) < (( float )neth / h))
{
new_w = netw;
new_h = (h * netw) / w;
}
else
{
new_h = neth;
new_w = (w * neth) / h;
}
new_w = netw;
new_h = neth;
for (i = 0; i < n; ++i)
{
box b = dets[i].bbox;
......@@ -629,8 +621,14 @@ void get_input_data_darknet(const char* image_file, float* input_data, int net_h
{
im.data[i] = im.data[i] / 255;
}
sized = letterbox(im, net_w, net_h);
memcpy(input_data, sized.data, size * sizeof(float));
int ow = net_w;
int oh = net_h;
sized = resize_image(im, ow, oh);
float *resize_data = (float*)sized.data;
for (int i = 0; i < size; i++)
{
input_data[i] = resize_data[i];
}
free_image(sized);
free_image(im);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册