mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-25 12:39:25 +01:00
* add trainer interface * add trainer script * add model init support for pipelineadd pipeline tutorial and fix bugs * add text classification evaluation to maas lib * add quickstart and prepare env doc * relax requirements for torch and sentencepiece * merge release/0.1 and fix conflict * modelhub support for model and pipeline Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/8868339
132 lines
3.2 KiB
JSON
132 lines
3.2 KiB
JSON
{
|
|
"framework": "pytorch",
|
|
|
|
"task": "image_classification",
|
|
|
|
"model": {
|
|
"type": "Resnet50ForImageClassification",
|
|
"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"
|
|
}
|
|
}
|
|
},
|
|
|
|
|
|
"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": {
|
|
"batch_size": 32,
|
|
"learning_rate": 0.00001,
|
|
"lr_scheduler_type": "cosine",
|
|
"num_epochs": 20
|
|
},
|
|
|
|
"evaluation": {
|
|
"batch_size": 32,
|
|
"metrics": ["accuracy", "precision", "recall"]
|
|
}
|
|
|
|
}
|