allanzelener / YAD2K

YAD2K: Yet Another Darknet 2 Keras
Other
2.71k stars 879 forks source link

how to use .weights file and what's meaning? #156

Open quliang93 opened 5 years ago

quliang93 commented 5 years ago

Hi, guys: It's really hard to understand these codes below, I mean , if we can't see .weights, how can I parse hyper-parameters from .weights? by the way, what is major? minor? revision? and why read(12)? major, minor, revision = np.ndarray(shape=(3, ), dtype='int32', buffer=weights_file.read(12)) if (major*10+minor)>=2 and major<1000 and minor<1000: seen = np.ndarray(shape=(1,), dtype='int64', buffer=weights_file.read(8)) else: seen = np.ndarray(shape=(1,), dtype='int32', buffer=weights_file.read(4)) print('Weights Header: ', major, minor, revision, seen)

Thanks a lot!