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

how can I train network with mnist one class only? #2

Open
lerndeep opened this issue May 14, 2020 · 2 comments
Open

how can I train network with mnist one class only? #2

lerndeep opened this issue May 14, 2020 · 2 comments

Comments

@lerndeep
Copy link

No description provided.

@lerndeep
Copy link
Author

I also want to generate one class 1000 images only please let me know.

@hcnoh
Copy link
Owner

hcnoh commented May 14, 2020

Hello! Thank you for visiting my repo. This repo does not provide currently the situation that you want. But I can help you to modify the code so that you can train only one class.

If you check the train.py line 27 to 29, you can find the following part:

features = np.vstack([loader.train_features, loader.test_features]).astype(np.float32)

num_sets = loader.num_train_sets + loader.num_test_sets

This part is what you have to modify. The following modification can be helpful to you:

features = np.vstack([loader.train_features[np.where(loader.train_labels == 0)], loader.test_features[np.where(loader.test_labels == 0)]]).astype(np.float32)

num_sets = loader.train_features[np.where(loader.train_labels == 0)].shape[0] + loader.test_features[np.where(loader.test_labels == 0)].shape[0]

This example is for only using class 0, about 7000 images (training 6000 + test 1000).

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

2 participants