AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.71k stars 7.96k forks source link

Eval yolov4 tiny on arm with opencv #6714

Open ghost opened 4 years ago

ghost commented 4 years ago

I tried to run yolov4 tiny on arm architecture, but get inference time 3x compare to yolov3 tiny. I used opencv 4.4. What`s wrong?

AlexeyAB commented 4 years ago
ghost commented 4 years ago

So, I've tried to evaluate network with OpenCV 4.4. Here is my compile params for it :

cmake -DCMAKE_BUILD_TYPE=RELEASE -DSOFTFP=ON -DENABLE_VFPV3=ON -DENABLE_NEON=ON -DCMAKE_TOOLCHAIN_FILE=/home/konstantin/Work/opencv-4.4.0/platforms/linux/arm-gnueabi.toolchain.cmake DOPENCV_EXTRA_MODULES_PATH="/home/konstantin/Work/opencv_contrib-4.4.0/modules" ../

Architecture - armv7hf

results:

OpenCV - - - net - - - - - time per frame 4.3 - - - - yolov3 tiny - - - - - 1.5s 4.4 - - - - yolov3 tiny - - - - - 1.5s 4.4 - - - - yolov4 tiny - - - - - 5.5s

my cfg: `[net] batch=1 subdivisions=1 width=416 height=416 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1 flip=0

learning_rate=0.00261 burn_in=1000 max_batches = 150000 policy=steps steps=50000,80000 scales=.1,.1

[convolutional] batch_normalize=1 filters=32 size=3 stride=2 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=3 stride=2 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[route] layers=-1 groups=2 group_id=1

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[route] layers = -1,-2

[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=leaky

[route] layers = -6,-1

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[route] layers=-1 groups=2 group_id=1

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[route] layers = -1,-2

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[route] layers = -6,-1

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[route] layers=-1 groups=2 group_id=1

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[route] layers = -1,-2

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[route] layers = -6,-1

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

##################################

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=21 activation=linear

[yolo] mask = 3,4,5 anchors = 11, 28, 18, 42, 25, 61, 37, 87, 55,130, 93,211 classes=2 num=6 jitter=.3 scale_x_y = 1.05 cls_normalizer=1.0 iou_normalizer=0.07 iou_loss=ciou ignore_thresh = .7 truth_thresh = 1 random=0 resize=1.5 nms_kind=greedynms beta_nms=0.6

[route] layers = -4

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[upsample] stride=2

[route] layers = -1, 23

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=21 activation=linear

[yolo] mask = 1,2,3 anchors = 11, 28, 18, 42, 25, 61, 37, 87, 55,130, 93,211 classes=2 num=6 jitter=.3 scale_x_y = 1.05 cls_normalizer=1.0 iou_normalizer=0.07 iou_loss=ciou ignore_thresh = .7 truth_thresh = 1 random=0 resize=1.5 nms_kind=greedynms beta_nms=0.6`

AlexeyAB commented 4 years ago

Do you use Darknet or OpenCV for inference? What command do you use?

ghost commented 4 years ago

I use Opencv net.forward().

AlexeyAB commented 4 years ago

Try to compile OpenCV with Tengine: https://github.com/opencv/opencv/wiki/Tengine-based-acceleration

If it doesn't help - try to force supporting XNNPACK in OpenCV: https://github.com/opencv/opencv/issues/16726

ghost commented 4 years ago

thx, I will try

seekingdeep commented 3 years ago

@water5tyle what are the results you are getting now