2

https://github.com/deep-diver/Soccer-Ball-Detection-YOLOv2

I get loading yolo.weights .... and then

AssertionError: expect 202335260 bytes, found 203934260

However, when I run the same command with default dataset it works. I downloaded the weights file from https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

I modify the line self.offset = 16 in the ./darkflow/utils/loader.py file and replace with self.offset = 20. But can not solve the issue.

How I can solve this issue?

gameon67
  • 3,981
  • 5
  • 35
  • 61

3 Answers3

2

Just to add to @ Zrufy's answer In darkflow/utils/loader.py

class weights_walker(object):
"""incremental reader of float32 binary files"""
def __init__(self, path):
    self.eof = False # end of file
    self.path = path  # current pos
    if path is None: 
        self.eof = True
        return
    else: 
        self.size = os.path.getsize(path)# save the path
        major, minor, revision, seen = np.memmap(path,
            shape = (), mode = 'r', offset = 0,
            dtype = '({})i4,'.format(4))
        self.transpose = major > 1000 or minor > 1000
        self.offset = 16 + 203934260 - 202335260

Make the change so that the last line is of the form

self.offset = 16 + found_value - expected_value

found_value and expected_value can be taken from the assertion error that you face.

1

I got the same problem, and solved it with Ign0reLee's help. You can find the detail in https://github.com/deep-diver/Soccer-Ball-Detection-YOLOv2/issues/3

Basically, it happened when your network configuration (.cfg) and weight file (.weights) mismatch., I think the cfg file in this repo is not correct for the official weight file.

Please try this weight file

https://pjreddie.com/media/files/yolov2.weights

with this cfg file Ign0reLee put in the issue page

Wish you luck

陈敏华
  • 1,365
  • 1
  • 9
  • 9
0

the method in which you need to change from 16 to 20 the self.offset does not work. The only working method for this bug is:

updated self.offset = old_offset_value + (found_value - expected_value)

for example in your case put in place in self.offset instead of 16 this:

16+(203934260-202314760)

let me know!

Zrufy
  • 423
  • 9
  • 22