deep-diver / Soccer-Ball-Detection-YOLOv2

YOLOv2 trained against custom dataset
118 stars 43 forks source link

yolov2.weights #19

Open minsuk-sung opened 4 years ago

minsuk-sung commented 4 years ago
options = {"model": "cfg/yolo_custom.cfg", 
           "load": "bin/yolo.weights",
           "batch": 8,
           "epoch": 100,
           "gpu": 1.0,
           "train": True,
           "annotation": "./annotations/",
           "dataset": "./images/"}

tfnet = TFNet(options)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-10-200f77f1939f> in <module>
----> 1 tfnet = TFNet(options)

AssertionError: expect 202335260 bytes, found 203934260

Is YOLO weights changed before?

Zrufy commented 4 years ago

https://stackoverflow.com/questions/55224586/assertionerror-expect-202335260-bytes-found-203934260-soccer-ball-detection-us/58269646#58269646

minsuk-sung commented 4 years ago

@Zrufy Thanks a lot, I will try

Tanmay-Kulkarni101 commented 4 years ago

@Zrufy It worked perfectly.

Just to elaborate, change the loader.py file. When I ran it on google colab, after globally installing darkflow, you can find it on - /usr/local/lib/python3.6/dist-packages/darkflow/utils/loader.py

Furthermore, in walk function

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 + 44948600 - 44138056

Make the change according to the error you are facing. In the last line as shown in the above block. Hope it helps.

Zrufy commented 4 years ago

if you found the answer useful, help me on stackoverflow. So that those who have the same problem will immediately find the solution.