Media-Smart / vedadet

A single stage object detection toolbox based on PyTorch
Apache License 2.0
498 stars 128 forks source link

cant load the weighs file I trained #47

Closed GaoXinJian-USTC closed 3 years ago

GaoXinJian-USTC commented 3 years ago

I use tinaface resnet50 you pretrained to train my self data. I got three pth output (optimizer,meta,weights) ,then I use the weights.pth to be loaded by the inference but an error occured : failed reading zip archive.. which pth file should be loaded to inference?

hxcai commented 3 years ago

@Gaoxj2020 Do you use the same pytorch version to train and inference?

GaoXinJian-USTC commented 3 years ago

@Gaoxj2020 Do you use the same pytorch version to train and inference?

Thanks , I solved this problem by removing priex=“backbone”.

GaoXinJian-USTC commented 3 years ago

@Gaoxj2020 Do you use the same pytorch version to train and inference? By the way, can mean and STD be calculated by my following method? means = [0, 0, 0] stdevs = [0, 0, 0]

index = 1 num_imgs = 0

for file in os.listdir(paths): if (file.endswith('.png')): print('{}/{}'.format(index, len(os.listdir(paths)))) index += 1 a = os.path.join(paths,file)

print(a[:-1])

    num_imgs += 1
    print(a)
    img = cv2.imread(a)
    img = np.asarray(img)
    img_ = img.astype(np.float32)
    for i in range(3):
        means[i] += img_[:,:,i].mean()
        stdevs[i] += img_[:,:,i].std()

print(num_imgs) means.reverse() stdevs.reverse()

means = np.asarray(means) / num_imgs stdevs = np.asarray(stdevs) / num_imgs

hxcai commented 3 years ago

@Gaoxj2020 This method is ok.

GaoXinJian-USTC commented 3 years ago

@Gaoxj2020 This method is ok.

if I train tinaface with my dataset, which parameters are important and need to be changed? Thanks a lot!

hxcai commented 3 years ago

@Gaoxj2020 Most parameters matter, you should understand the algorithm and change parameters to fit your data.