Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Tiny Yolo v2 Darkflow trasformation

idata
Employee
1,020 Views

I have been working in a project using Yolo v2 with darkflow in the Movidius.

 

In: https://github.com/fernandodelacalle/yolo-darkflow-movidius you can find my code, with and example and instructions also with a dokerfile and a demo web app using flask.

 

Hope some of you find it useful!!

0 Kudos
7 Replies
idata
Employee
697 Views

@fdnn Nice! Thanks for posting this. I was able to run it with no issues.

0 Kudos
idata
Employee
697 Views

@fdnn @Tome_at_Intel

 

I have some problems in this example, the operation process is done according to your requirements.

 

Traceback (most recent call last):

 

File "/usr/local/bin/mvNCCompile", line 169, in

 

create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args)

 

File "/usr/local/bin/mvNCCompile", line 148, in create_graph

 

load_ret = load_network(args, parser, myriad_config)

 

File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 100, in load_network

 

parse_ret = parse_tensor(arguments, myriad_conf)

 

File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 385, in parse_tensor

 

int(input_shape[1]),

 

TypeError: int returned non-int (type NoneType)

 

Can you give me some help, thank you
0 Kudos
idata
Employee
697 Views

@fdnnI solved the above problem, but I have an error when I run yolov2 in moveidius.When I run python3 test_movidius.py -i video.avi, the following error occurs.

 

song@sgj:~/workspace/yolo-darkflow-movidius$ python3 test_movidius.py -i video.avi

 

D: [ 0] ncDeviceCreate:307 ncDeviceCreate index 0

 

D: [ 0] ncDeviceCreate:307 ncDeviceCreate index 1

 

D: [ 0] ncDeviceOpen:501 File path /usr/local/lib/mvnc/MvNCAPI-ma2450.mvcmd

 

I: [ 0] ncDeviceOpen:507 ncDeviceOpen() XLinkBootRemote returned success 0

 

I: [ 0] ncDeviceOpen:536 XLinkConnect done - link Id 0

 

D: [ 0] ncDeviceOpen:550 done

 

I: [ 0] ncDeviceOpen:552 Booted 1.4-ma2450 -> VSC

 

I: [ 0] getDevAttributes:373 Device attributes

 

I: [ 0] getDevAttributes:376 Device FW version: 2.4.2450.f0

 

I: [ 0] getDevAttributes:378 mvTensorVersion 2.4

 

I: [ 0] getDevAttributes:379 Maximum graphs: 10

 

I: [ 0] getDevAttributes:380 Maximum fifos: 20

 

I: [ 0] getDevAttributes:382 Maximum graph option class: 1

 

I: [ 0] getDevAttributes:384 Maximum device option class: 1

 

I: [ 0] getDevAttributes:385 Device memory capacity: 522073264

 

I: [ 0] ncGraphAllocate:923 Starting Graph allocation sequence

 

I: [ 0] ncGraphAllocate:988 Sent graph

 

D: [ 0] ncGraphAllocate:1013 Graph Status 0 rc 0

 

D: [ 0] ncGraphAllocate:1059 Input tensor w 416 h 416 c 3 n 1 totalSize 1038336 wstide 6 hstride 2496 cstride 2 layout 0

 

D: [ 0] ncGraphAllocate:1072 output tensor w 13 h 13 c 50 n 1 totalSize 16900 wstide 100 hstride 1300 cstride 2 layout 0

 

I: [ 0] ncGraphAllocate:1126 Graph allocation completed successfully

 

I: [ 0] ncFifoCreate:2126 Init fifo

 

I: [ 0] ncFifoAllocate:2321 Creating fifo

 

I: [ 0] ncFifoCreate:2126 Init fifo

 

I: [ 0] ncFifoAllocate:2321 Creating fifo

 

D: [ 0] ncFifoWriteElem:2592 No layout conversion is needed 0

 

D: [ 0] convertDataTypeAndLayout:170 src data type 1 dst data type 0

 

D: [ 0] convertDataTypeAndLayout:172 SRC: w 416 h 416 c 3 w_s 12 h_s 4992 c_s 4

 

D: [ 0] convertDataTypeAndLayout:174 DST: w 416 h 416 c 3 w_s 6 h_s 2496 c_s 2

 

D: [ 0] ncFifoWriteElem:2617 write count 0 num_elements 2 userparam 0x7fd040469ef0

 

I: [ 0] ncGraphQueueInference:3048 trigger start

 

I: [ 0] ncGraphQueueInference:3145 trigger end

 

D: [ 0] ncFifoReadElem:2686 No layout conversion is needed 0

 

D: [ 0] convertDataTypeAndLayout:170 src data type 0 dst data type 1

 

D: [ 0] convertDataTypeAndLayout:172 SRC: w 13 h 13 c 50 w_s 100 h_s 1300 c_s 2

 

D: [ 0] convertDataTypeAndLayout:174 DST: w 13 h 13 c 50 w_s 200 h_s 2600 c_s 4

 

D: [ 0] ncFifoReadElem:2714 num_elements 2 userparam 0x7fd04047a1a8 output length 33800

 

/usr/local/lib/python3.5/dist-packages/mvnc/mvncapi.py:418: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead

 

tensor = numpy.fromstring(tensor.raw, dtype=numpy.float32)

 

FPS: 3.92

 

Traceback (most recent call last):

 

File "test_movidius.py", line 110, in

 

main()

 

File "test_movidius.py", line 107, in main

 

args.threshold)

 

File "test_movidius.py", line 65, in inference_video

 

y_out = np.reshape(output, (13, 13,125))

 

File "/home/songgongjun/.local/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 279, in reshape

 

return _wrapfunc(a, 'reshape', newshape, order=order)

 

File "/home/songgongjun/.local/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 51, in _wrapfunc

 

return getattr(obj, method)(*args, **kwds)

 

ValueError: cannot reshape array of size 8450 into shape (13,13,125)

 

I don't know where the problem is.
AAhma26
Beginner
697 Views

Hello,

 

I am trying to deploy customized YOLO network. It is a tensorflow implementation of yolo v2. I am getting same error as yours, Can you post your solution that how did you solved this?

 

 

res.shape: (1, 13, 13, 3, 8)

Traceback (most recent call last):

 File "/usr/local/bin/mvNCCompile", line 206, in <module>

  create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args.cpp, args)

 File "/usr/local/bin/mvNCCompile", line 185, in create_graph

  load_ret = load_network(args, parser, myriad_config)

 File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 146, in load_network

  parse_ret = parse_tensor(arguments, myriad_conf)

 File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 1751, in parse_tensor

  res = res.reshape(1, 1, res.shape[0])

ValueError: cannot reshape array of size 4056 into shape (1,1,1)

 

 

Can you share the guidelines for compiling yolo network with Movidius.

 

Thanks.

0 Kudos
idata
Employee
697 Views

Hi @songgongjun could you tell me:

 

1- the size of the variable frame before and after this assignment: frame = yolo_utils.pre_proc_img(frame, meta)

 

2- the contents of the meta dict.
0 Kudos
idata
Employee
697 Views

@fdnn Thank you, I have solved my problem.

0 Kudos
idata
Employee
697 Views

@fdnn. I have a model saved using the save_pb command in darkflow and was planning to run it on NCS. Is it must, to freeze the tf graph before saving it as a pb file, to have it run on NCS?

0 Kudos
Reply