Skip to content

视觉任务评测基准

zhezhaoa edited this page Dec 11, 2022 · 2 revisions

以下是视觉任务评测基准解决方案的简要介绍。可以在这里找到下面使用的预训练模型。

CIFAR10

利用ViT-base-patch16-224-in21k在CIFAR10数据集上做微调和预测示例:

python3 finetune/run_image_classifier.py --pretrained_model_path models/vit_base_patch16_224_model.bin \
                                         --tokenizer virtual \
                                         --config_path models/vit/base-16-224_config.json \
                                         --train_path datasets/cifar10/train.tsv \
                                         --dev_path datasets/cifar10/test.tsv \
                                         --output_model_path models/image_classifier_model.bin \
                                         --epochs_num 3 --batch_size 64

python3 inference/run_image_classifier_infer.py --load_model_path models/image_classifier_model.bin \
                                                --tokenizer virtual \
                                                --config_path models/vit/base-16-224_config.json \
                                                --test_path datasets/cifar10/test.tsv \
                                                --prediction_path datasets/cifar10/prediction.tsv \
                                                --labels_num 10

利用ViT-large-patch16-224-in21k在CIFAR10数据集上做微调和预测示例:

python3 finetune/run_image_classifier.py --pretrained_model_path models/vit_large_patch16_224_model.bin \
                                         --tokenizer virtual \
                                         --config_path models/vit/large-16-224_config.json \
                                         --train_path datasets/cifar10/train.tsv \
                                         --dev_path datasets/cifar10/test.tsv \
                                         --output_model_path models/image_classifier_model.bin \
                                         --epochs_num 3 --batch_size 64

python3 inference/run_image_classifier_infer.py --load_model_path models/image_classifier_model.bin \
                                                --tokenizer virtual \
                                                --config_path models/vit/large-16-224_config.json \
                                                --test_path datasets/cifar10/test.tsv \
                                                --prediction_path datasets/cifar10/prediction.tsv \
                                                --labels_num 10

CIFAR100

利用ViT-base-patch16-224-in21k在CIFAR100数据集上做微调和预测示例:

python3 finetune/run_image_classifier.py --pretrained_model_path models/vit_base_patch16_224_model.bin \
                                         --tokenizer virtual \
                                         --config_path models/vit/base-16-224_config.json \
                                         --train_path datasets/cifar100/train.tsv \
                                         --dev_path datasets/cifar100/test.tsv \
                                         --output_model_path models/image_classifier_model.bin \
                                         --epochs_num 3 --batch_size 64

python3 inference/run_image_classifier_infer.py --load_model_path models/image_classifier_model.bin \
                                                --tokenizer virtual \
                                                --config_path models/vit/base-16-224_config.json \
                                                --test_path datasets/cifar100/test.tsv \
                                                --prediction_path datasets/cifar100/prediction.tsv \
                                                --labels_num 100

利用ViT-large-patch16-224-in21k在CIFAR100数据集上做微调和预测示例:

python3 finetune/run_image_classifier.py --pretrained_model_path models/vit_large_patch16_224_model.bin \
                                         --tokenizer virtual \
                                         --config_path models/vit/large-16-224_config.json \
                                         --train_path datasets/cifar100/train.tsv \
                                         --dev_path datasets/cifar100/test.tsv \
                                         --output_model_path models/image_classifier_model.bin \
                                         --epochs_num 3 --batch_size 64

python3 inference/run_image_classifier_infer.py --load_model_path models/image_classifier_model.bin \
                                                --tokenizer virtual \
                                                --config_path models/vit/large-16-224_config.json \
                                                --test_path datasets/cifar100/test.tsv \
                                                --prediction_path datasets/cifar100/prediction.tsv \
                                                --labels_num 100
Clone this wiki locally