-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
47 lines (40 loc) · 1.28 KB
/
config.py
File metadata and controls
47 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Third party imports
import torch
from torchvision import transforms
# Device configuration
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Data preprocessing details
data_transforms = {
'train': transforms.Compose([
transforms.Resize((224, 224)),
transforms.RandomResizedCrop(200),
transforms.RandomHorizontalFlip(0.5),
transforms.RandomVerticalFlip(0.5),
# transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2, hue=0.2),
# transforms.RandomPerspective(distortion_scale=0.3, p=0.1),
transforms.RandomRotation(degrees=(0, 180)),
# transforms.RandomPosterize(bits=2),
# transforms.RandomEqualize(),
# transforms.RandomAdjustSharpness(sharpness_factor=2),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
'val': transforms.Compose([
transforms.Resize((224, 224)),
# transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
}
# train related values
LR = 0.003
MOMENTUM = 0.2
# FREEZE_EPOCHS = 5
# UNFREEZE_EPOCHS = 50
TRIPLET_MARGIN = 0.9 # the margin to be used for triplet loss
PARAMS = {'batch_size': 8,
'shuffle': True,
'num_workers': 16}
EMBEDDING_SIZE = 128
# command line arguments
ARGS = {}