RuntimeError: cannot dereference null pointer from cdata 'float *

I have tried running the darknet test from the test folder as well as the darknet tutorial but am getting the same error in both cases.

Executing the following lines:

dtype = ‘float32’
batch_size = 1
print(“Converting darknet to nnvm symbols…”)
sym, params = nnvm.frontend.darknet.from_darknet(net, dtype)

But the following error occurs

Loading weights from ./yolo.weights…Done!
Converting darknet to nnvm symbols…
Traceback (most recent call last):
File “from_darknet.py”, line 141, in
sym, params = nnvm.frontend.darknet.from_darknet(net, dtype)
File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 643, in from_darknet
return _from_darknet(net, dtype)
File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 617, in _from_darknet
_get_darknet_params(net.layers[i], layer_name, tvmparams, dtype)
File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 566, in _get_darknet_params
_get_convolution_weights(layer, opname, tvmparams, dtype)
File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 414, in _get_convolution_weights
biases = _read_memory_buffer((layer.n, ), layer.biases, dtype)
File “/usr/local/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/darknet.py”, line 397, in _read_memory_buffer
data_np[i] = data[i]
RuntimeError: cannot dereference null pointer from cdata ‘float *’

This worked for me.

I tried installing the packages and changed the code but even after the changes, I get the same error. I tried compiling using the alexnet model and I get the same error in the same place.

@Bryanscott13 we checked the issue, found that this issue will happen when you download from darknet master branch and compiled the library.
It wont happen if you download from https://github.com/siju-samuel/darknet and compile the library and use it while running.

@PariksheetPinjari909 @Bryanscott13
What’s the difference from compiling with master branch?
Would you please share the changes made in siju-samuel darknet repo ?
Thanks!!

@PariksheetPinjari909 I have tried running from_darknet.py with yolov3 and meet the same problem:

RuntimeError: cannot dereference null pointer from cdata ‘float *’

I download libdarknet.so from darknet master branch, because the .so in https://github.com/siju-samuel/darknet does not work for the latest version of tvm. How can I fix the problem?

Hello, any progress with this issue ? I have also the same problem. …

@PariksheetPinjari909
Your solution does not work for me, it seems that this version of darknet is pretty old and even cannot parse my .cfg file correctly:

16 Type not recognized: [yolo]
Unused field: ‘mask = 6,7,8’
Unused field: ‘anchors = 10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373
,326’
Unused field: ‘classes = 80’
Unused field: ‘num = 9’
Unused field: ‘jitter = .3’
Unused field: ‘ignore_thresh = .5’
Unused field: ‘truth_thresh = 1’
Unused field: ‘random = 1’

Hello, I also met same issue when I start to run the test case in darknet tutorial with latest TVM code. And the libdarknet.so was generated in my MacBook from darknet master branch. Any update or suggestions? @PariksheetPinjari909