hx173149 / C3D-tensorflow

C3D is a modified version of BVLC tensorflow to support 3D ConvNets.
MIT License
588 stars 265 forks source link

overfitting #125

Open MrLuer opened 3 years ago

MrLuer commented 3 years ago

train acc near 1 but validation acc lower than 0.1

MrLuer commented 3 years ago

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)