Code Monkey home page Code Monkey logo

mxnet-yolo's People

Contributors

liumusicforever avatar zhreshold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mxnet-yolo's Issues

training on my own dataset

Hii ,
I wanted to know that can I use your model for object detection on my own dataset ?

I want to detect the points, tick values and tick marks in my scatterplot images.
I have scatterplots images and the idl files containing the bounding boxes for the tick values, tick marks and points.

module 'mxnet.symbol' has no attribute 'stack_neighbor'

Hi.
I have some error.

module 'mxnet.symbol' has no attribute 'stack_neighbor'

this is my flow:

$ git clone https://github.com/zhreshold/mxnet-yolo.git
>> (omit)
$ cd mxnet-yolo
~mxnet-yolo$ git clone --recursive https://github.com/dmlc/mxnet
>> (omit)
~mxnet-yolo$ cd mxnet; 
~mxnet-yolo/mxnet$ make -j4
>> (omit)
~mxnet-yolo/mxnet$ git submodule update --recursive --init
~mxnet-yolo/mxnet$ cd ..

after build mxnet, I tried run demo.py

~mxnet-yolo$ python demo.py
Traceback (most recent call last):
  File "demo.py", line 100, in <module>
    ctx, args.nms_thresh, args.force_nms)
  File "demo.py", line 41, in get_detector
    .get_symbol(len(CLASSES), nms_thresh, force_nms)
  File "/home/ubuntu/Notebooks/heidi/test_project/mxdir/mxnet-yolo/symbol/symbol_darknet19_yolo.py", line 25, in get_symbol
    conv5_6 = mx.sym.stack_neighbor(data=conv5_5, kernel=(2, 2), name='stack_downsample')
AttributeError: module 'mxnet.symbol' has no attribute 'stack_neighbor'

so I have done your solution(git submodule update --recursive --init) again in the mxnet-yolo directory.

~mxnet-yolo$ git submodule update --recursive --init
fatal: reference is not a tree: 37455ca2b2c19ff88b3d1a3075a02a4f49db9dd6
Unable to checkout '37455ca2b2c19ff88b3d1a3075a02a4f49db9dd6' in submodule path 'mxnet'

Benchmark of Batch Forward

Hi @zhreshold , this tabel is my experience of testing speed in your repo ,
Hardware specification:
1.CPU : i7-7700
2.GPU : 1080ti
3.Mem : 32G

image

My code for testing :

import os
import cv2
import numpy as np
import sys 
import mxnet as mx
import importlib
from timeit import default_timer as timer
from detect.detector import Detector


CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat',
           'bottle', 'bus', 'car', 'cat', 'chair',
           'cow', 'diningtable', 'dog', 'horse',
           'motorbike', 'person', 'pottedplant',
           'sheep', 'sofa', 'train', 'tvmonitor')

img = './data/demo/dog.jpg'
net = 'darknet19_yolo'
sys.path.append(os.path.join(os.getcwd(), 'symbol'))
net = importlib.import_module("symbol_" + net) \
            .get_symbol(len(CLASSES), nms_thresh = 0.5, force_nms = True)
prefix = os.path.join(os.getcwd(), 'model', 'yolo2_darknet19_416')
epoch = 0
data_shape = 608
mean_pixels = (123,117,104)
ctx = mx.gpu(0)
batch = 3



detector = Detector(net, prefix, epoch, data_shape, mean_pixels, ctx=ctx,batch_size = batch)

ims = [cv2.resize(cv2.imread(img),(data_shape,data_shape)) for i in range(batch)]

def get_batch(imgs):
    img_len = len(imgs)
    l = []
    for i in range(batch):
        if i < img_len:
            img = np.swapaxes(imgs[i], 0, 2)
            img = np.swapaxes(img, 1, 2) 
            img = img[np.newaxis, :] 
            l.append(img[0])
        else:
            l.append(np.zeros(shape=(3, data_shape, data_shape)))
    l = np.array(l)
    return [mx.nd.array(l)]


data  = get_batch(ims)


start = timer()

for i in range(200):
    det_batch = mx.io.DataBatch(data,[])
    detector.mod.forward(det_batch, is_train=False)
    detections = detector.mod.get_outputs()[0].asnumpy()
    result = []
    for i in range(detections.shape[0]):
        det = detections[i, :, :]
        res = det[np.where(det[:, 0] >= 0)[0]]
        result.append(res)


time_elapsed = timer() - start
print("Detection time for {} images: {:.4f} sec , fps : {:.4f}".format(batch*200, time_elapsed , (batch*200/time_elapsed)))

Hope this experiment helpful to you.

why error when using pretrained model?

hi, I tried to train a 2-class model. i used your pretrained model .but error likes this:
Check failed: from.shape() == to->shape() operands shape mismatchfrom.shape = (125,) to.shape=(30,)

my command is : python train.py --train-path /data/data/train.rec --val-path /data/data/val.rec --pretrained /data/model/yolo2_darknet19_416 --epoch 0

ps ,i have changed the class_num to 1.

What the number of column 9 mean in file *.lst?

Hello.I want to train this model with my own data.So I try writing a script to make .lst file.However,I can't understand what the number of column 9 mean.Part like this

26 2 6 17.0000 0.0028 0.3785 0.9972 0.8750 0.0000 14.0000 0.2017 0.4062 0.6790 0.5764 1.0000 VOC2012\JPEGImages\2011_002834.jpg
27 2 6 11.0000 0.0180 0.2693 0.5020 0.7200 0.0000 11.0000 0.4580 0.1840 1.0000 0.8827 0.0000 VOC2012\JPEGImages\2009_002031.jpg
28 2 6 18.0000 0.0040 0.4899 0.1020 0.7695 1.0000 18.0000 0.0680 0.2968 0.9740 0.9395 0.0000 VOC2012\JPEGImages\2011_002779.jpg

As it shows.It's 0.0000 or 1.0000.But what this choice deponds on?

video_demo.py line 99

Hi, I find that line 99 in video_demo.py the code feed "res" to get _bboxes. But is this "res" right? Maybe it should be "result" since in line 98 we have result.append(res) .

bboxes = get_bboxes(frm,res)

Can not run using GPU

Hello, thank you for sharing the code. I am tried to run your code using gpu. I met the error. Please help me. I run with: python demo.py --gpu
Error is:

[09:41:08] src/operator/././cudnn_algoreg-inl.h:65: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)
[09:41:26] /home/nvidia/mxnet-yolo/mxnet/dmlc-core/include/dmlc/./logging.h:304: [09:41:26] src/operator/./cudnn_convolution-inl.h:583: Check failed: e == CUDNN_STATUS_SUCCESS (4 vs. 0) cuDNN: CUDNN_STATUS_INTERNAL_ERROR

Stack trace returned 8 entries:
[bt] (0) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x44) [0x7fa6f6d38c]
[bt] (1) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZZN5mxnet2op18CuDNNConvolutionOpIfE10SelectAlgoERKNS_7ContextERKSt6vectorIN4nnvm6TShapeESaIS8_EESC_15cudnnDataType_tSD_ENKUlNS_10RunContextEE_clESE_+0x484) [0x7fa85d05d4]
[bt] (2) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvN5mxnet10RunContextENS0_6engine18CallbackOnCompleteEEZNS0_6Engine8PushSyncESt8functionIFvS1_EENS0_7ContextERKSt6vectorIPNS2_3VarESaISC_EESG_NS0_10FnPropertyEiPKcEUlS1_S3_E_E9_M_invokeERKSt9_Any_dataOS1_OS3_+0x4c) [0x7fa77a025c]
[bt] (3) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE+0x88) [0x7fa7b2c508]
[bt] (4) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEZZNS2_23ThreadedEnginePerDevice13PushToExecuteEPNS2_8OprBlockEbENKUlvE1_clEvEUlS5_E_E9_M_invokeERKSt9_Any_dataOS5_+0x110) [0x7fa7b37518]
[bt] (5) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFSt8functionIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEES8_EEE6_M_runEv+0x48) [0x7fa7b2eb50]
[bt] (6) /usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xb8280) [0x7f8b15d280]
[bt] (7) /lib/aarch64-linux-gnu/libpthread.so.0(+0x6fc4) [0x7fb3596fc4]

[09:41:26] /home/nvidia/mxnet-yolo/mxnet/dmlc-core/include/dmlc/./logging.h:304: [09:41:26] src/engine/./threaded_engine.h:329: [09:41:26] src/operator/./cudnn_convolution-inl.h:583: Check failed: e == CUDNN_STATUS_SUCCESS (4 vs. 0) cuDNN: CUDNN_STATUS_INTERNAL_ERROR

Stack trace returned 8 entries:
[bt] (0) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x44) [0x7fa6f6d38c]
[bt] (1) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZZN5mxnet2op18CuDNNConvolutionOpIfE10SelectAlgoERKNS_7ContextERKSt6vectorIN4nnvm6TShapeESaIS8_EESC_15cudnnDataType_tSD_ENKUlNS_10RunContextEE_clESE_+0x484) [0x7fa85d05d4]
[bt] (2) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvN5mxnet10RunContextENS0_6engine18CallbackOnCompleteEEZNS0_6Engine8PushSyncESt8functionIFvS1_EENS0_7ContextERKSt6vectorIPNS2_3VarESaISC_EESG_NS0_10FnPropertyEiPKcEUlS1_S3_E_E9_M_invokeERKSt9_Any_dataOS1_OS3_+0x4c) [0x7fa77a025c]
[bt] (3) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE+0x88) [0x7fa7b2c508]
[bt] (4) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEZZNS2_23ThreadedEnginePerDevice13PushToExecuteEPNS2_8OprBlockEbENKUlvE1_clEvEUlS5_E_E9_M_invokeERKSt9_Any_dataOS5_+0x110) [0x7fa7b37518]
[bt] (5) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFSt8functionIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEES8_EEE6_M_runEv+0x48) [0x7fa7b2eb50]
[bt] (6) /usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xb8280) [0x7f8b15d280]
[bt] (7) /lib/aarch64-linux-gnu/libpthread.so.0(+0x6fc4) [0x7fb3596fc4]

An fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.

Stack trace returned 6 entries:
[bt] (0) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x44) [0x7fa6f6d38c]
[bt] (1) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE+0x2c4) [0x7fa7b2c744]
[bt] (2) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEZZNS2_23ThreadedEnginePerDevice13PushToExecuteEPNS2_8OprBlockEbENKUlvE1_clEvEUlS5_E_E9_M_invokeERKSt9_Any_dataOS5_+0x110) [0x7fa7b37518]
[bt] (3) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFSt8functionIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEES8_EEE6_M_runEv+0x48) [0x7fa7b2eb50]
[bt] (4) /usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xb8280) [0x7f8b15d280]
[bt] (5) /lib/aarch64-linux-gnu/libpthread.so.0(+0x6fc4) [0x7fb3596fc4]

terminate called after throwing an instance of 'dmlc::Error'
  what():  [09:41:26] src/engine/./threaded_engine.h:329: [09:41:26] src/operator/./cudnn_convolution-inl.h:583: Check failed: e == CUDNN_STATUS_SUCCESS (4 vs. 0) cuDNN: CUDNN_STATUS_INTERNAL_ERROR

Stack trace returned 8 entries:
[bt] (0) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x44) [0x7fa6f6d38c]
[bt] (1) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZZN5mxnet2op18CuDNNConvolutionOpIfE10SelectAlgoERKNS_7ContextERKSt6vectorIN4nnvm6TShapeESaIS8_EESC_15cudnnDataType_tSD_ENKUlNS_10RunContextEE_clESE_+0x484) [0x7fa85d05d4]
[bt] (2) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvN5mxnet10RunContextENS0_6engine18CallbackOnCompleteEEZNS0_6Engine8PushSyncESt8functionIFvS1_EENS0_7ContextERKSt6vectorIPNS2_3VarESaISC_EESG_NS0_10FnPropertyEiPKcEUlS1_S3_E_E9_M_invokeERKSt9_Any_dataOS1_OS3_+0x4c) [0x7fa77a025c]
[bt] (3) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE+0x88) [0x7fa7b2c508]
[bt] (4) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEZZNS2_23ThreadedEnginePerDevice13PushToExecuteEPNS2_8OprBlockEbENKUlvE1_clEvEUlS5_E_E9_M_invokeERKSt9_Any_dataOS5_+0x110) [0x7fa7b37518]
[bt] (5) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFSt8functionIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEES8_EEE6_M_runEv+0x48) [0x7fa7b2eb50]
[bt] (6) /usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xb8280) [0x7f8b15d280]
[bt] (7) /lib/aarch64-linux-gnu/libpthread.so.0(+0x6fc4) [0x7fb3596fc4]

An fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.

Stack trace returned 6 entries:
[bt] (0) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x44) [0x7fa6f6d38c]
[bt] (1) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE+0x2c4) [0x7fa7b2c744]
[bt] (2) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt17_Function_handlerIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEZZNS2_23ThreadedEnginePerDevice13PushToExecuteEPNS2_8OprBlockEbENKUlvE1_clEvEUlS5_E_E9_M_invokeERKSt9_Any_dataOS5_+0x110) [0x7fa7b37518]
[bt] (3) /home/nvidia/mxnet-yolo/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFSt8functionIFvSt10shared_ptrIN5mxnet6engine10ThreadPool11SimpleEventEEEES8_EEE6_M_runEv+0x48) [0x7fa7b2eb50]
[bt] (4) /usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xb8280) [0x7f8b15d280]
[bt] (5) /lib/aarch64-linux-gnu/libpthread.so.0(+0x6fc4) [0x7fb3596fc4]

Aborted (core dumped)

Thank you very much

import

Traceback (most recent call last):
File "E:\python_workspace\mxnet-yolo-master\demo.py", line 7, in
from detect.detector import Detector
File "E:\python_workspace\mxnet-yolo-master\detect\detector.py", line 5, in
from dataset.testdb import TestDB
File "E:\python_workspace\mxnet-yolo-master\dataset\testdb.py", line 2, in
from imdb import Imdb
ModuleNotFoundError: No module named 'imdb'

symbol_darknet19.py batchnorm layers use_global_stats problems

Hi,

in symbol/symbol_darknet19.py,there is some batchnorm layers
and I notice that use_global_stats should be True when demo or inference.
But in the demo.py I didn't see use_global_stats set to be True. Did I make a mistake?
thanks.

conv = mx.symbol.BatchNorm(data=conv, name="bn_{}".format(name))

MXNet built from source problem

Hi,
I use my own MXNet pakages that built from source,beacause I also has some custom operator.
As you mentioned in your readme file ,some custom operators are not presented in official MXNet
Can I add these additional custom operators to my own MXNet source?
Which operators should I copy to my own MXNet pakages?
Any help would be appericated! Thanks a lot!

Best Regards,
PengWei

Why not use the mxnet.image.ImageDetIter?

@zhreshold Hi, I want to get an implementation yolo with mxnet, and your project do great help for me. But I have a confuse when I read your implementation, why you didn't use the mxnet.image.ImageDetIter rather than write a new iterator, even this class also has augmenter functions? Is there any reason I don't know? Really want to your reply

can't reproduce 71% mAP

I cloned your repo and follow the readme.md to train (python train.py --gpus 0,1,2,3 --epoch 0
), but the final max mAP I can get is about 52%, did I missing something? thank you very much if you have any tricks during training!

Error in building

I'm getting some errors when I'm trying to build the library.And I need some advice.

Environment info

Operating System: Windows 10 x64
Compiler: Visual Studio 14 2015 Win 64/ openblas + CUDA SDK 8.0.44

Error Message

I have used cmake-3.10.1 to obtian the bulid folder.Then I try to bulid the libmxnet.dll. However, I am having difficulties compiling the .sln file.This is the error message part:

2>  Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir/src/ndarray/Release/cuda_compile_1_generated_ndarray_function.cu.obj
2>  ndarray_function.cu
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>  ndarray_function.cu
2>  Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir/src/operator/Release/cuda_compile_1_generated_activation.cu.obj
2>  activation.cu
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>  activation.cu
2>  Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir/src/operator/Release/cuda_compile_1_generated_batch_norm.cu.obj
2>  batch_norm.cu
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode
2>
2>  batch_norm.cu
2>  Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir/src/operator/Release/cuda_compile_1_generated_batch_norm_v1.cu.obj
2>  batch_norm_v1.cu
2>d:\python3ex\mxnetyolo\mxnet\dmlc-core\include\dmlc\./optional.h(26): warning : "constexpr" is ignored here in Microsoft mode

help please.

Saving Output Image in the Python

Hi. I am pretty new to YOLO implementation. I was wondering which function I could call to save the output image/video to a directory?

The output image would contain the detected boundaries.

how to design anchor size?

hi,thanks for your sharing.i want to train on my dataset,my targets are much smaller. could you tell me how to change the anchor size . in your code it is like this:
anchors = [
1.3221, 1.73145,
3.19275, 4.00944,
5.05587, 8.09892,
9.47112, 4.84053,
11.2364, 10.0071]

i dont know exact means of these corresponds, is it (w,h) of box ?

voc trainning convergence problem

@zhreshold thank you for your great job.

I use your dev branch to train voc. After 206 batch, the results is:

INFO:root:Epoch[206] Train-Acc=0.084337
INFO:root:Epoch[206] Train-IOU=0.387760
INFO:root:Epoch[206] Train-BG-score=0.002908
INFO:root:Epoch[206] Train-Obj-score=0.003026
INFO:root:Epoch[206] Time cost=391.103
INFO:root:Saved checkpoint to "/home/sooda/deep/object/mxnet-yolo/model/yolo2_416-0207.params"
INFO:root:Epoch[206] Validation-aeroplane=0.000000
INFO:root:Epoch[206] Validation-bicycle=0.000000
INFO:root:Epoch[206] Validation-bird=0.000000
INFO:root:Epoch[206] Validation-boat=0.000000
INFO:root:Epoch[206] Validation-bottle=0.000000
INFO:root:Epoch[206] Validation-bus=0.000000
INFO:root:Epoch[206] Validation-car=0.000000
INFO:root:Epoch[206] Validation-cat=0.000000
INFO:root:Epoch[206] Validation-chair=0.000000
INFO:root:Epoch[206] Validation-cow=0.000000
INFO:root:Epoch[206] Validation-diningtable=0.000000
INFO:root:Epoch[206] Validation-dog=0.001082
INFO:root:Epoch[206] Validation-horse=0.000000
INFO:root:Epoch[206] Validation-motorbike=0.000000
INFO:root:Epoch[206] Validation-person=0.004746
INFO:root:Epoch[206] Validation-pottedplant=0.000000
INFO:root:Epoch[206] Validation-sheep=0.000000
INFO:root:Epoch[206] Validation-sofa=0.000000
INFO:root:Epoch[206] Validation-train=0.000000
INFO:root:Epoch[206] Validation-tvmonitor=0.000000
INFO:root:Epoch[206] Validation-mAP=0.000291

Maybe something is wrong? your master branch is ok?

I also try to use your master branch, but when I run git submodule update, it reports Unable to checkout '9b9855bae145f0a387accf94ca36687e6fe4ee53' in submodule path 'mxnet', maybe you need to update your master branch's submodule?

mxnet.base.MXNetError: Failed loading Op yolo_output of type _contrib_Yolo2Output: [13:11:48] src/core/op.cc:55: Check failed: op != nullptr Operator _contrib_Yolo2Output is not registered

Hi FOlks,

I have downloaded the yolo2_resnet50_416-symbol.jason and kept in models directory, but when i execute the video_demo.py, I get the following error, Can you please help me fix this, I jus wanna detect humans, so i guess the demo model will work ... Please correct me, If I am wrong

**amcsgpu@amcsgpu:~/Zero/mxnet-yolo-master$ python video_demo.py
/home/amcsgpu/Zero/mxnet-yolo-master/model/yolo2_resnet50_416
Traceback (most recent call last):
File "video_demo.py", line 109, in
main()
File "video_demo.py", line 85, in main
detector = get_mxnet_detector(net, prefix, epoch, data_shape, mean_pixels, ctx=ctx,batch_size = 1)
File "video_demo.py", line 43, in get_mxnet_detector
detector = Detector(net, prefix, epoch, data_shape, mean_pixels, ctx=ctx,batch_size = 1)
File "/home/amcsgpu/Zero/mxnet-yolo-master/detect/detector.py", line 34, in init
load_symbol, args, auxs = mx.model.load_checkpoint(model_prefix, epoch)
File "/usr/local/lib/python2.7/dist-packages/mxnet/model.py", line 420, in load_checkpoint
symbol = sym.load('%s-symbol.json' % prefix)
File "/usr/local/lib/python2.7/dist-packages/mxnet/symbol/symbol.py", line 2518, in load
check_call(_LIB.MXSymbolCreateFromFile(c_str(fname), ctypes.byref(handle)))
File "/usr/local/lib/python2.7/dist-packages/mxnet/base.py", line 146, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: Failed loading Op yolo_output of type _contrib_Yolo2Output: [13:11:48] src/core/op.cc:55: Check failed: op != nullptr Operator _contrib_Yolo2Output is not registered

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x192112) [0x7fef4f4d2112]
[bt] (1) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x4292c95) [0x7fef535d2c95]
[bt] (2) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x42c49eb) [0x7fef536049eb]
[bt] (3) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x42c9d10) [0x7fef53609d10]
[bt] (4) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x42c35bf) [0x7fef536035bf]
[bt] (5) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x24d65cf) [0x7fef518165cf]
[bt] (6) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x4295f8d) [0x7fef535d5f8d]
[bt] (7) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x24d7761) [0x7fef51817761]
[bt] (8) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x24d65cf) [0x7fef518165cf]
[bt] (9) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x4295f8d) [0x7fef535d5f8d]**

The different effects of different resnet pretrained models

Hi, before updating the resnet pretrained model in mxnet-yolo, I used the resnet pretrained model from mxnet-ssd to train. But after updating, I found that the effects of the resnet pretrained model from mxnet-yolo was better than that from mxnet-ssd. What's the reason? I'm a little puzzled. Thx.

about Fine-Grained Features

Hi, @zhreshold ,

we know from the paper that yolo v2 adds a passthrough layer to bring features from the earlier layer at 26x26 resolution to get the fine-grained features.
However, I find these codes when i read the file 'symbol_darkent19_yolo.py' in this respository,

conv5_5 = bone.get_internals()["conv5_5_output"] conv5_6 = mx.sym.stack_neighbor(data=conv5_5, kernel=(2, 2), name='stack_downsample') concat = mx.sym.Concat(*[conv5_6, conv7_2], dim=1)

I think these codes just concate the conv5_5 output with the activation_output of stage 7, right?
Why not just concate the activation outputs form stage 5 and 7, like the mode the source code of yolo v2 used in darknet?
Do you compare the performances of the different connection type? if yes, tell me the result please.

Loss function

Hi,
Can you tell me where did you define the loss function? I want to apply a modification to it and test it out

Thanks,

time cost of this work

Hi, @zhreshold, thx for ur contribution, the code is clean and clearness.

However, I'm wondering the speed of the detect process since it spent about 0.1s when i ran the demo to detecting a image in demo dir with a GTX 1080 Gpu card. It is hard to say that is real-time...

Did i forget something about configuration??

ImportError: No module named moviepy.editor

Hi,
When i python video_demo.py ,there are some error. Can you help me ?

$ python video_demo.py
Traceback (most recent call last):
File "video_demo.py", line 5, in
from moviepy.editor import *
ImportError: No module named moviepy.editor

method get_symbol() cannot be invoked correctly

Environment info

----------Python Info----------
('Version      :', '2.7.12')
('Compiler     :', 'GCC 4.4.7 20120313 (Red Hat 4.4.7-1)')
('Build        :', ('default', 'Jul  2 2016 17:42:40'))
('Arch         :', ('64bit', 'ELF'))
------------Pip Info-----------
('Version      :', '8.1.2')
('Directory    :', '/export/docker/JXQ-23-46-48.h.chinabank.com.cn/saber/mxnet_env/mxnet_2.7/lib/python2.7/site-packages/pip')
----------MXNet Info-----------
No MXNet installed.
----------System Info----------
('Platform     :', 'Linux-3.10.0-514.el7.x86_64-x86_64-with-centos-7.3.1611-Core')
('system       :', 'Linux')
('node         :', 'JXQ-240-26-35.h.chinabank.com.cn')
('release      :', '3.10.0-514.el7.x86_64')
('version      :', '#1 SMP Tue Nov 22 16:42:41 UTC 2016')
----------Hardware Info----------
('machine      :', 'x86_64')
('processor    :', 'x86_64')
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                48
On-line CPU(s) list:   0-47
Thread(s) per core:    2
Core(s) per socket:    12
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
Stepping:              1
CPU MHz:               2200.000
BogoMIPS:              4400.10
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              30720K
NUMA node0 CPU(s):     0-11,24-35
NUMA node1 CPU(s):     12-23,36-47
----------Network Test----------
Setting timeout: 10

maxnet build info

I have build maxnet as the tutorials as #34

Error Info

Namespace(cpu=True, data_shape=416, deploy_net=False, dir=None, epoch=0, extension=None, force_nms=True, gpu_id=0, images='./data/demo/dog.jpg', mean_b=104, mean_g=117, mean_r=123, network='darknet19', nms_thresh=0.5, prefix='/export/docker/JXQ-23-46-48.h.chinabank.com.cn/saber/mxnet/mxnet-yolo/model/yolo2', show_timer=True, thresh=0.5)
('darknet19', '/export/docker/JXQ-23-46-48.h.chinabank.com.cn/saber/mxnet/mxnet-yolo/model/yolo2', 0, 416, (123, 117, 104), cpu(0))
3
Traceback (most recent call last):
  File "demo.py", line 102, in <module>
    ctx, args.nms_thresh, args.force_nms)
  File "demo.py", line 42, in get_detector
    net = importlib.import_module('symbol_' + net).get_symbol(len(CLASSES), nms_thresh, force_nms)
TypeError: get_symbol() takes at most 1 argument (3 given)

Question

The error occurred when I run python demo.py --cpu
What can I do to resolve the problem?
Waiting for your response, thx!

mxnet submodule build failure

I get a build failure when attempting to build the mxnet submodule. Building the mxnet source from master doesn't have a problem.

/usr/local/cuda/bin/nvcc -c -o build/src/operator/rnn_gpu.o -std=c++11 -Xcompiler -D_FORCE_INLINES -O3 -ccbin g++  -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=[sm_61,compute_61] --fatbin-options -compress-all -Xcompiler "-DMSHADOW_FORCE_STREAM -Wall -Wsign-compare -O3 -DNDEBUG=1 -I/home/jim/data/git/mxnet-yolo/mxnet/mshadow/ -I/home/jim/data/git/mxnet-yolo/mxnet/dmlc-core/include -fPIC -I/home/jim/data/git/mxnet-yolo/mxnet/nnvm/include -I/home/jim/data/git/mxnet-yolo/mxnet/dlpack/include -Iinclude -funroll-loops -Wno-unused-variable -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-local-typedefs -msse3 -I/usr/local/cuda/include -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMSHADOW_RABIT_PS=0 -DMSHADOW_DIST_PS=0 -DMSHADOW_USE_PASCAL=0 -DMXNET_USE_OPENCV=1 -I/usr/include/opencv -fopenmp -DMXNET_USE_LAPACK -DMSHADOW_USE_CUDNN=1  -I/home/jim/data/git/mxnet-yolo/mxnet/cub -DMXNET_USE_NVRTC=0" src/operator/rnn.cu
src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnRNNDescriptor_t" is incompatible with parameter of type "cudnnHandle_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "uint32_t" is incompatible with parameter of type "cudnnRNNDescriptor_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnDropoutDescriptor_t" is incompatible with parameter of type "int"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnRNNInputMode_t" is incompatible with parameter of type "cudnnDropoutDescriptor_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnDirectionMode_t" is incompatible with parameter of type "cudnnRNNInputMode_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnRNNMode_t" is incompatible with parameter of type "cudnnDirectionMode_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: argument of type "cudnnDataType_t" is incompatible with parameter of type "cudnnRNNMode_t"
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

src/operator/./cudnn_rnn-inl.h(435): error: too few arguments in function call
          detected during:
            instantiation of "void mxnet::op::CuDNNRNNOp<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" 
(54): here
            instantiation of "mxnet::op::CuDNNRNNOp<DType>::CuDNNRNNOp(mxnet::op::RNNParam) [with DType=float]" 
src/operator/rnn.cu(20): here

8 errors detected in the compilation of "/tmp/tmpxft_000022b6_00000000-17_rnn.compute_61.cpp1.ii".
Makefile:274: recipe for target 'build/src/operator/rnn_gpu.o' failed
make: *** [build/src/operator/rnn_gpu.o] Error 2
make: *** Waiting for unfinished jobs....

Acc don't change

Batch [340] Speed: 16.10 samples/sec Acc=1.000000 IOU=0.406950 BG-score=0.019727 Obj-score=0.093377
INFO:root:Epoch[1] Batch [360] Speed: 16.05 samples/sec Acc=1.000000 IOU=0.429875 BG-score=0.016203 Obj-score=0.117543
INFO:root:Epoch[1] Batch [380] Speed: 16.09 samples/sec Acc=1.000000 IOU=0.445871 BG-score=0.017749 Obj-score=0.126029
INFO:root:Epoch[1] Batch [400] Speed: 16.19 samples/sec Acc=1.000000 IOU=0.474623 BG-score=0.016878 Obj-score=0.109704
INFO:root:Epoch[1] Batch [420] Speed: 16.19 samples/sec Acc=1.000000 IOU=0.450529 BG-score=0.015971 Obj-score=0.100655
INFO:root:Epoch[1] Batch [440] Speed: 16.09 samples/sec Acc=1.000000 IOU=0.461909 BG-score=0.015480 Obj-score=0.093190

Errors when running demo.py and video_demo.py

I get the following error when I run demo.py even though I built mxnet from source
AttributeError: module 'mxnet.contrib.symbol' has no attribute 'Yolo2Output'

I also get this when I run video_demo.py
resnet50_yolov2_resnet50_416-symbol.json": No such file or directory

I have only downloaded darknet and resnet50 as indicated in the readme

Any ideas ?

IOU Computation

Hello @zhreshold ,
I am so confuse about your IOU computation during training , can you explain the file at "train/metrix.py line 106" :

max_iou = np.amax(ious[:, j])

you only select one maximum IOU from each bboxes's IOU in each images , but why didn't you compute the average of each IOUs in each images ?
And the second question is , why didn't you give the default threshold to compute IOU ?

Maybe I make something mistake , Can you explain the reason ?

Could the code can do real-time job the same like darknet?

The origin code in C from official web in 'pjreddie.com' did some real-time jobs, like webcam object recognition or the same job in videos . I just want to know whether the author of mxnet-yolo offer the same function in python, if did, how to use . Thanks for author's effort in the mxnet-yolo :)

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.