# image-classification **Repository Path**: huihui308/image-classification ## Basic Information - **Project Name**: image-classification - **Description**: image-classification - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: david - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-19 - **Last Updated**: 2025-12-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README convnext-v2-pytorch --> https://github.com/Jacky-Android/convnext-v2-pytorch resnet-pytorch --> https://github.com/akamaster/pytorch_resnet_cifar10 ResNet --> https://github.com/FrancescoSaverioZuppichini/ResNet/tree/master ```shell pip install torchinfo easydict ``` convnext-v2-pytorch: ```shell CUDA_VISIBLE_DEVICES=1 python train.py --num_classes=16 CUDA_VISIBLE_DEVICES=1 python train.py --num_classes=24 --data-path=/home/david/docker/share/dataset/classification/tricycle_train_data_optimize/train CUDA_VISIBLE_DEVICES=0 python train.py --num_classes=5 \ --data-path=/home/david/docker/share/dataset/classification/fengkou/dataset \ --augment randaug --randaug-num-ops 4 \ --randaug-magnitude 10 --randaug-bins 31 \ --cutmix-alpha 1.0 --mixup-alpha 0.8 5 # OR use both: 6 --cutmix-alpha 0.5 7 --mixup-alpha 0.5 CUDA_VISIBLE_DEVICES=0 python train.py \ --num_classes 5 --epochs 50 --batch-size 8 --lr 1e-4 --wd 5e-2 \ --data-path /home/david/docker/share/dataset/classification/fengkou/dataset \ --augment randaug --randaug-num-ops 3 \ --randaug-magnitude 9 --cutmix-alpha 1.0 --mixup-alpha 0.8 \ --drop-path-rate 0.3 CUDA_VISIBLE_DEVICES=0 python train.py \ --num_classes 5 --epochs 50 --batch-size 8 --lr 1e-4 --wd 1e-2 \ --data-path /home/david/docker/share/dataset/classification/fengkou/dataset \ --augment randaug --randaug-num-ops 3 \ --randaug-magnitude 8 --cutmix-alpha 0.8 --mixup-alpha 0.8 \ --drop-path-rate 0.15 \ --random-erase-prob 0.4 --noise-factor 0.15 --noise-prob 0.6 \ --randaug-magnitude 8 CUDA_VISIBLE_DEVICES=0 python train.py \ --num_classes 5 --epochs 50 --batch-size 8 --lr 1e-4 --wd 2e-2 \ --data-path /home/david/docker/share/dataset/classification/fengkou/dataset \ --augment randaug --randaug-num-ops 4 \ --randaug-magnitude 9 --cutmix-alpha 1.0 --mixup-alpha 1.0 \ --drop-path-rate 0.2 \ --random-erase-prob 0.5 --noise-factor 0.2 --noise-prob 0.7 CUDA_VISIBLE_DEVICES=0 python train_atto.py \ --num_classes 3 --epochs 100 --batch-size 64 --lr 5e-5 --wd 5e-2 \ --data-path /home/david/docker/share/dataset/classification/fengkou/dataset \ --augment randaug --randaug-num-ops 4 \ --randaug-magnitude 9 --cutmix-alpha 1.0 --mixup-alpha 1.0 \ --random-erase-prob 0.5 --noise-factor 0.2 --noise-prob 0.7 ``` ✦ 根据我对您代码的分析,您已经使用了ConvNeXt v2 atto模型,并添加了多种先进的数据增强技术。以下是具体的模型优化策略: 1. 当前您已经使用的技术: - RandAugment(num_ops=4, magnitude=9) - MixUp(alpha=1.0) - CutMix(alpha=1.0) - Random Erasing(prob=0.5) - Random Noise(factor=0.2, prob=0.7) - AdamW优化器(lr=5e-5, wd=5e-2) resnet-pytorch: ```shell CUDA_VISIBLE_DEVICES=1 python trainer.py \ --data /home/david/docker/share/dataset/classification/tricycle_train_data_optimize \ --arch resnet20 --num-classes 22 --epochs 50 --batch-size 128 \ --save-dir tricycle_model/resnet20 CUDA_VISIBLE_DEVICES=1 python trainer.py \ --data /home/david/docker/share/dataset/classification/New_Plant_Diseases_Dataset/new_plant_diseases_dataset_augmented \ --arch resnet20 --num-classes 41 --epochs 200 --batch-size 128 \ --save-dir models/plant_disease_model/resnet20 ``` 模型参数量对比: - Atto (最小): 3,389,005 参数 - Femto: 4,850,165 参数 - Pico: 8,555,845 参数 - Nano: 14,986,005 参数 - Tiny: 27,870,341 参数 - Base (当前使用): 87,697,925 参数 - Large: 196,427,525 参数 - Huge (最大): 657,486,725 参数 ✦ 要训练一个ResNet20网络,根据我们刚刚对trainer.py的修改,你可以使用以下命令: 1 python trainer.py --data /path/to/your/dataset --arch resnet20 --num-classes 10 --epochs 200 --batch-size 128 --save-dir resnet20_model 如果你要训练自定义数据集,请将 /path/to/your/dataset 替换为你的数据集路径,并将 --num-classes 的值改为你的数据集类别数。 例如,如果你的数据集有5个类别,路径在 ./my_dataset,命令将是: 1 python trainer.py --data ./my_dataset --arch resnet20 --num-classes 5 --epochs 200 --batch-size 128 --save-dir resnet20_model 如果你只想用原始的CIFAR-10数据集训练(不提供--data参数): 1 python trainer.py --arch resnet20 --epochs 200 --batch-size 128 --save-dir resnet20_cifar10 参数说明: - --arch resnet20: 指定使用resnet20架构 - --num-classes: 类别数量(CIFAR-10是10,自定义数据集请设置为实际类别数) - --epochs: 训练轮数 - --batch-size: 批次大小 - --save-dir: 模型保存目录 - --data: 自定义数据集路径(可选,如果不提供则使用CIFAR-10)