SENet-Tensorflow icon indicating copy to clipboard operation
SENet-Tensorflow copied to clipboard

new dataset

Open HanYuanyuaner opened this issue 6 years ago • 3 comments

@taki0112 I want to train new dataset with this model, must I resize the image to 32*32?

HanYuanyuaner avatar May 18 '18 10:05 HanYuanyuaner

I have the same question as you,have you found way to train own pictures dataset? @HanYuanyuaner

jerryhero avatar May 27 '19 03:05 jerryhero

me too

Ggmatch avatar May 31 '19 13:05 Ggmatch

you could change prepare_data function to load your own dataset.

def prepare_data(): print("======Loading data======") traindata_dir = 'e:/train/' #change your traindata_dir testdata_dir = 'e:/test/' #change your testdata_dir image_dim = image_size * image_size * img_channels label_names = ['cardboard','glass','metal','trash','paper','plastic'] #change your classes label_count = len(label_names) train_files = [traindata_dir+s for s in label_names] test_files = [testdata_dir+s for s in label_names] train_data, train_labels = load_data(train_files, traindata_dir, label_count) test_data, test_labels = load_data(test_files, testdata_dir, label_count)

print("Train data:", np.shape(train_data), np.shape(train_labels)) 
print("Test data :", np.shape(test_data), np.shape(test_labels))
print("======Load finished======") 
print("======Shuffling data======") 
indices = np.random.permutation(len(train_data)) 
train_data = train_data[indices] 
train_labels = train_labels[indices]
indices = np.random.permutation(len(test_data)) 
test_data = test_data[indices] 
test_labels = test_labels[indices]
print("======Prepare Finished======") 
return train_data, train_labels, test_data, test_labels

or you can train and test ratio to generate trainfile and testflie list then load.

Bella722 avatar May 21 '20 01:05 Bella722