Upload 2 files
Browse files
config.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
model = dict(
|
2 |
+
type='ImageClassifier',
|
3 |
+
backbone=dict(
|
4 |
+
type='ResNet',
|
5 |
+
depth=50,
|
6 |
+
num_stages=4,
|
7 |
+
out_indices=(3, ),
|
8 |
+
style='pytorch',
|
9 |
+
init_cfg=dict(
|
10 |
+
type='Pretrained',
|
11 |
+
checkpoint=
|
12 |
+
'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_3rdparty-mill_in21k_20220331-faac000b.pth',
|
13 |
+
prefix='backbone')),
|
14 |
+
neck=dict(type='GlobalAveragePooling'),
|
15 |
+
head=dict(
|
16 |
+
type='LinearClsHead',
|
17 |
+
num_classes=2,
|
18 |
+
in_channels=2048,
|
19 |
+
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
|
20 |
+
topk=(1, )))
|
21 |
+
dataset_type = 'CustomDataset'
|
22 |
+
classes = ['No', 'Yes']
|
23 |
+
img_norm_cfg = dict(
|
24 |
+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
25 |
+
train_pipeline = [
|
26 |
+
dict(type='LoadImageFromFile'),
|
27 |
+
dict(type='RandomResizedCrop', size=224),
|
28 |
+
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
|
29 |
+
dict(
|
30 |
+
type='Normalize',
|
31 |
+
mean=[123.675, 116.28, 103.53],
|
32 |
+
std=[58.395, 57.12, 57.375],
|
33 |
+
to_rgb=True),
|
34 |
+
dict(type='ImageToTensor', keys=['img']),
|
35 |
+
dict(type='ToTensor', keys=['gt_label']),
|
36 |
+
dict(type='Collect', keys=['img', 'gt_label'])
|
37 |
+
]
|
38 |
+
test_pipeline = [
|
39 |
+
dict(type='LoadImageFromFile'),
|
40 |
+
dict(type='Resize', size=(256, -1)),
|
41 |
+
dict(type='CenterCrop', crop_size=224),
|
42 |
+
dict(
|
43 |
+
type='Normalize',
|
44 |
+
mean=[123.675, 116.28, 103.53],
|
45 |
+
std=[58.395, 57.12, 57.375],
|
46 |
+
to_rgb=True),
|
47 |
+
dict(type='ImageToTensor', keys=['img']),
|
48 |
+
dict(type='Collect', keys=['img'])
|
49 |
+
]
|
50 |
+
data = dict(
|
51 |
+
samples_per_gpu=16,
|
52 |
+
workers_per_gpu=4,
|
53 |
+
train=dict(
|
54 |
+
type='CustomDataset',
|
55 |
+
data_prefix='/work/home/acy25a367n/pornpics/pornpics-download-s',
|
56 |
+
ann_file=
|
57 |
+
'/work/home/acy25a367n/mmclassification/pornpics/outdoor/outdoor_train.csv',
|
58 |
+
pipeline=[
|
59 |
+
dict(type='LoadImageFromFile'),
|
60 |
+
dict(type='RandomResizedCrop', size=224),
|
61 |
+
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
|
62 |
+
dict(
|
63 |
+
type='Normalize',
|
64 |
+
mean=[123.675, 116.28, 103.53],
|
65 |
+
std=[58.395, 57.12, 57.375],
|
66 |
+
to_rgb=True),
|
67 |
+
dict(type='ImageToTensor', keys=['img']),
|
68 |
+
dict(type='ToTensor', keys=['gt_label']),
|
69 |
+
dict(type='Collect', keys=['img', 'gt_label'])
|
70 |
+
]),
|
71 |
+
val=dict(
|
72 |
+
type='CustomDataset',
|
73 |
+
data_prefix='/work/home/acy25a367n/pornpics/pornpics-download-s',
|
74 |
+
ann_file=
|
75 |
+
'/work/home/acy25a367n/mmclassification/pornpics/outdoor/outdoor_valid.csv',
|
76 |
+
pipeline=[
|
77 |
+
dict(type='LoadImageFromFile'),
|
78 |
+
dict(type='Resize', size=(256, -1)),
|
79 |
+
dict(type='CenterCrop', crop_size=224),
|
80 |
+
dict(
|
81 |
+
type='Normalize',
|
82 |
+
mean=[123.675, 116.28, 103.53],
|
83 |
+
std=[58.395, 57.12, 57.375],
|
84 |
+
to_rgb=True),
|
85 |
+
dict(type='ImageToTensor', keys=['img']),
|
86 |
+
dict(type='Collect', keys=['img'])
|
87 |
+
]),
|
88 |
+
test=dict(
|
89 |
+
type='CustomDataset',
|
90 |
+
data_prefix='/work/home/acy25a367n/pornpics/pornpics-download-s',
|
91 |
+
ann_file=
|
92 |
+
'/work/home/acy25a367n/mmclassification/pornpics/outdoor/outdoor_valid.csv',
|
93 |
+
pipeline=[
|
94 |
+
dict(type='LoadImageFromFile'),
|
95 |
+
dict(type='Resize', size=(256, -1)),
|
96 |
+
dict(type='CenterCrop', crop_size=224),
|
97 |
+
dict(
|
98 |
+
type='Normalize',
|
99 |
+
mean=[123.675, 116.28, 103.53],
|
100 |
+
std=[58.395, 57.12, 57.375],
|
101 |
+
to_rgb=True),
|
102 |
+
dict(type='ImageToTensor', keys=['img']),
|
103 |
+
dict(type='Collect', keys=['img'])
|
104 |
+
]))
|
105 |
+
evaluation = dict(
|
106 |
+
interval=1, metric='accuracy', metric_options=dict(topk=(1, )))
|
107 |
+
optimizer = dict(
|
108 |
+
type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005, nesterov=True)
|
109 |
+
optimizer_config = dict(grad_clip=None)
|
110 |
+
lr_config = dict(
|
111 |
+
policy='CosineAnnealing',
|
112 |
+
min_lr=0,
|
113 |
+
warmup='linear',
|
114 |
+
warmup_iters=5,
|
115 |
+
warmup_ratio=0.01,
|
116 |
+
warmup_by_epoch=True)
|
117 |
+
runner = dict(type='EpochBasedRunner', max_epochs=100)
|
118 |
+
checkpoint_config = dict(interval=1)
|
119 |
+
log_config = dict(interval=4, hooks=[dict(type='TextLoggerHook')])
|
120 |
+
dist_params = dict(backend='nccl')
|
121 |
+
log_level = 'INFO'
|
122 |
+
load_from = None
|
123 |
+
resume_from = None
|
124 |
+
workflow = [('train', 1)]
|
125 |
+
checkpoint = 'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_3rdparty-mill_in21k_20220331-faac000b.pth'
|
126 |
+
work_dir = 'work_dirs/resnet50_8xb32_outdoor'
|
127 |
+
gpu_ids = [0]
|
model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7cbe61cb733167e29c8c3e4e52fd0de5babcb10e6a34d9f02001a9cf3d3a2292
|
3 |
+
size 188469887
|