mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-25 12:39:25 +01:00
179 lines
4.3 KiB
JSON
179 lines
4.3 KiB
JSON
{
|
|
"framework": "pytorch",
|
|
|
|
"task": "image_classification",
|
|
|
|
"model": {
|
|
"type": "classification",
|
|
"pretrained": null,
|
|
"backbone": {
|
|
"type": "ResNet",
|
|
"depth": 50,
|
|
"out_indices": [
|
|
4
|
|
],
|
|
"norm_cfg": {
|
|
"type": "BN"
|
|
}
|
|
},
|
|
"head": {
|
|
"type": "ClsHead",
|
|
"with_avg_pool": true,
|
|
"in_channels": 2048,
|
|
"loss_config": {
|
|
"type": "CrossEntropyLossWithLabelSmooth",
|
|
"label_smooth": 0
|
|
},
|
|
"num_classes": 1000
|
|
}
|
|
},
|
|
|
|
"dataset": {
|
|
"train": {
|
|
"type": "ClsDataset",
|
|
"data_source": {
|
|
"list_file": "data/imagenet_raw/meta/train_labeled.txt",
|
|
"root": "data/imagenet_raw/train/",
|
|
"type": "ClsSourceImageList"
|
|
}
|
|
},
|
|
"val": {
|
|
"type": "ClsDataset",
|
|
"data_source": {
|
|
"list_file": "data/imagenet_raw/meta/val_labeled.txt",
|
|
"root": "data/imagenet_raw/validation/",
|
|
"type": "ClsSourceImageList"
|
|
}
|
|
},
|
|
"test": {}
|
|
},
|
|
|
|
|
|
"preprocessor":{
|
|
"train": [
|
|
{
|
|
"type": "RandomResizedCrop",
|
|
"size": 224
|
|
},
|
|
{
|
|
"type": "RandomHorizontalFlip"
|
|
},
|
|
{
|
|
"type": "ToTensor"
|
|
},
|
|
{
|
|
"type": "Normalize",
|
|
"mean": [
|
|
0.485,
|
|
0.456,
|
|
0.406
|
|
],
|
|
"std": [
|
|
0.229,
|
|
0.224,
|
|
0.225
|
|
]
|
|
},
|
|
{
|
|
"type": "Collect",
|
|
"keys": [
|
|
"img",
|
|
"gt_labels"
|
|
]
|
|
}
|
|
],
|
|
"val": [
|
|
{
|
|
"type": "Resize",
|
|
"size": 256
|
|
},
|
|
{
|
|
"type": "CenterCrop",
|
|
"size": 224
|
|
},
|
|
{
|
|
"type": "ToTensor"
|
|
},
|
|
{
|
|
"type": "Normalize",
|
|
"mean": [
|
|
0.485,
|
|
0.456,
|
|
0.406
|
|
],
|
|
"std": [
|
|
0.229,
|
|
0.224,
|
|
0.225
|
|
]
|
|
},
|
|
{
|
|
"type": "Collect",
|
|
"keys": [
|
|
"img",
|
|
"gt_labels"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
|
|
"train": {
|
|
"work_dir": "./work_dir",
|
|
"dataloader": {
|
|
"batch_size_per_gpu": 2,
|
|
"workers_per_gpu": 1
|
|
},
|
|
"optimizer": {
|
|
"type": "SGD",
|
|
"lr": 0.01,
|
|
"options": {
|
|
"grad_clip": {
|
|
"max_norm": 2.0
|
|
}
|
|
}
|
|
},
|
|
"lr_scheduler": {
|
|
"type": "StepLR",
|
|
"step_size": 2,
|
|
"options": {
|
|
"warmup": {
|
|
"type": "LinearWarmup",
|
|
"warmup_iters": 2
|
|
|
|
}
|
|
}
|
|
},
|
|
"hooks":
|
|
[
|
|
{
|
|
"type": "CheckpointHook",
|
|
"interval": 2
|
|
},
|
|
{
|
|
"type": "TextLoggerHook",
|
|
"interval": 1
|
|
},
|
|
{
|
|
"type": "IterTimerHook"
|
|
},
|
|
{
|
|
"type": "EvaluationHook",
|
|
"interval": 1
|
|
}
|
|
]
|
|
},
|
|
|
|
"evaluation": {
|
|
"dataloader": {
|
|
"batch_size_per_gpu": 2,
|
|
"workers_per_gpu": 1,
|
|
"shuffle": false
|
|
},
|
|
"metrics": ["accuracy", "precision", "recall"]
|
|
},
|
|
"pipeline": {
|
|
"type": "dummy"
|
|
}
|
|
|
|
}
|