Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new dataset #6

Open
HanYuanyuaner opened this issue May 18, 2018 · 3 comments
Open

new dataset #6

HanYuanyuaner opened this issue May 18, 2018 · 3 comments

Comments

@HanYuanyuaner
Copy link

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

@jerryhero
Copy link

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

@Ggmatch
Copy link

Ggmatch commented May 31, 2019

me too

@Bella722
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants