C3D-tensorflow icon indicating copy to clipboard operation
C3D-tensorflow copied to clipboard

overfitting

Open MrLuer opened this issue 5 years ago • 1 comments

train acc near 1 but validation acc lower than 0.1

MrLuer avatar Nov 01 '20 12:11 MrLuer

I find out what's wrong with it, not every class samples exist in train.list, in other words some calsses only exist in test.list. use python code below to generate train.list and test.list and replace the old one. you will get validation acc around 0.75-0.85

import os import random root = "D:/DataSets/UCF-101"

def get_img_list(path): return [os.path.join(path,x) for x in os.listdir(path) ]

train = open("train.list",'w+') test = open("test.list",'w+') dirs = get_img_list(root) for idx,dir in enumerate(dirs): d = get_img_list(dir) random.shuffle(d)

b =  0.2 * len(d)
for i in range(len(d)):
    print(d[i])
    if i < b:
        print("hell")
        test.write(d[i])
        test.write(" "+str(idx)+'\n')
    else:
       
        train.write(d[i])
        train.write(" "+str(idx)+'\n')
print(idx)

MrLuer avatar Dec 19 '20 08:12 MrLuer