Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AL_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

parser = argparse.ArgumentParser("Center Loss Example")
# dataset
parser.add_argument('-d', '--dataset', type=str, default='cifar10', choices=['mnist', 'cifar100', 'cifar10'])
parser.add_argument('-d', '--dataset', type=str, default='combined_wafer_data.npz', choices=['combined_wafer_data.npz'])
parser.add_argument('-j', '--workers', default=0, type=int,
help="number of data loading workers (default: 4)")
# optimization
Expand Down Expand Up @@ -281,15 +281,15 @@ def plot_features(features, labels, num_classes, epoch, prefix):
features: (num_instances, num_features).
labels: (num_instances).
"""
colors = ['C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9']
colors = ['C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8']
for label_idx in range(num_classes):
plt.scatter(
features[labels==label_idx, 0],
features[labels==label_idx, 1],
c=colors[label_idx],
s=1,
)
plt.legend(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], loc='upper right')
plt.legend(['0', '1', '2', '3', '4', '5', '6', '7', '8'], loc='upper right')
dirname = osp.join(args.save_dir, prefix)
if not osp.exists(dirname):
os.mkdir(dirname)
Expand Down
3 changes: 1 addition & 2 deletions datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import torchvision
from torch.utils.data import DataLoader
from torch.utils.data import SubsetRandomSampler
from simclr.modules.transformations import TransformsSimCLR
import random
import transforms

Expand Down Expand Up @@ -293,4 +292,4 @@ def create(name, known_class_, init_percent_, batch_size, use_gpu, num_workers,
init_percent = init_percent_
if name not in __factory.keys():
raise KeyError("Unknown dataset: {}".format(name))
return __factory[name](batch_size, use_gpu, num_workers, is_filter, is_mini, unlabeled_ind_train, labeled_ind_train)
return __factory[name](batch_size, use_gpu, num_workers, is_filter, is_mini, unlabeled_ind_train, labeled_ind_train)