thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

Valueerror : mmap length is greater than file size #387

Open QueenJuliaZxx opened 7 years ago

QueenJuliaZxx commented 7 years ago

I have got a problem when I was loading the model to initial the model,there exists yolo-tiny.weights in bin content and the yolo-tiny.cfg is in cfg/vi/.and I am sure the road is right.could you solve it for me.

flow --model /home/sys324/pycharm/Zxx_Project/darkflow-master/cfg/v1/yolo-tiny.cfg --load /home/sys324/pycharm/Zxx_Project/darkflow-master/bin/yolo-tiny.weights

/usr/local/lib/python2.7/dist-packages/darkflow/dark/darknet.py:54: UserWarning: ./cfg/yolo-tiny.cfg not found, use /home/sys324/pycharm/Zxx_Project/darkflow-master/cfg/v1/yolo-tiny.cfg instead cfg_path, FLAGS.model)) Parsing /home/sys324/pycharm/Zxx_Project/darkflow-master/cfg/v1/yolo-tiny.cfg Loading /home/sys324/pycharm/Zxx_Project/darkflow-master/bin/yolo-tiny.weights ... Traceback (most recent call last): File "/usr/local/bin/flow", line 6, in exec(compile(open(file).read(), file, 'exec')) File "/home/sys324/pycharm/Zxx_Project/darkflow-master/flow", line 6, in cliHandler(sys.argv) File "/usr/local/lib/python2.7/dist-packages/darkflow/cli.py", line 22, in cliHandler tfnet = TFNet(FLAGS) File "/usr/local/lib/python2.7/dist-packages/darkflow/net/build.py", line 58, in init darknet = Darknet(FLAGS) File "/usr/local/lib/python2.7/dist-packages/darkflow/dark/darknet.py", line 27, in init self.load_weights() File "/usr/local/lib/python2.7/dist-packages/darkflow/dark/darknet.py", line 82, in load_weights wgts_loader = loader.create_loader(args) File "/usr/local/lib/python2.7/dist-packages/darkflow/utils/loader.py", line 105, in create_loader return load_type(path, cfg) File "/usr/local/lib/python2.7/dist-packages/darkflow/utils/loader.py", line 19, in init self.load(args) File "/usr/local/lib/python2.7/dist-packages/darkflow/utils/loader.py", line 54, in load walker = weights_walker(path) File "/usr/local/lib/python2.7/dist-packages/darkflow/utils/loader.py", line 119, in init dtype = '({})i4,'.format(4)) File "/usr/local/lib/python2.7/dist-packages/numpy/core/memmap.py", line 264, in new mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start) ValueError: mmap length is greater than file size

exponentialbit1024 commented 6 years ago

+1

totallyradnetworks commented 4 years ago

I had this error come up as well. Please advise.

abdullahtarek commented 4 years ago

This error arises when the weights are either corrupted or does not match the cfg file you chose.

If it is corrupted then just download the weights again and make sure that the weights are downloaded fully.

And for the cfg make sure you are using the weights for the cfg file you chose, typically the naming I most cases are the same. If you are using tiny_yolo weights then use the tiny_yolo.cfg.