您现在的位置是:首页 >其他 >【五一创作】使用Resnet残差网络对图像进行分类(猫十二分类,模型定义、训练、保存、预测)(二)网站首页其他
【五一创作】使用Resnet残差网络对图像进行分类(猫十二分类,模型定义、训练、保存、预测)(二)
使用Resnet残差网络对图像进行分类
(猫十二分类,模型定义、训练、保存、预测)(二)
目录
接上篇文章
使用Resnet残差网络对图像进行分类(猫十二分类,模型定义、训练、保存、预测)(一)
(6)、数据集划分
#数据集划分
!paddlex --split_dataset --format ImageNet
--dataset_dir data/data10954/ImageNetDataset
--val_value 0.085
--test_value 0
2023-04-29 13:20:36 [INFO] Dataset split starts... 2023-04-29 13:20:36 [INFO] Dataset split done. 2023-04-29 13:20:36 [INFO] Train samples: 1980 2023-04-29 13:20:36 [INFO] Eval samples: 180 2023-04-29 13:20:36 [INFO] Test samples: 0 2023-04-29 13:20:36 [INFO] Split files saved in data/data10954/ImageNetDataset
运行时长:4.568秒结束时间:2023-04-29 13:20:37
(7)、训练集增强
# 训练集增强
from paddlex import transforms as T
train_transforms = T.Compose([
T.MixupImage(
alpha=1.5,
beta=1.5,
mixup_epoch=int(300 * 25. / 27)),
T.Resize(
target_size=438,
interp='CUBIC'),
# 以图像中心点扩散裁剪长宽为目标尺寸的正方形
T.RandomCrop(360),
# 以一定的概率对图像进行随机水平翻转
T.RandomHorizontalFlip(0.5),
# 以一定的概率对图像进行随机像素内容变换,可包括亮度、对比度、饱和度、色相角度、通道顺序的调整,模型训练时的数据增强操作
T.RandomDistort(
brightness_range=0.25,
brightness_prob=0.5,
contrast_range=0.25,
contrast_prob=0.5,
saturation_range=0.25,
saturation_prob=0.5,
hue_range=18.0,
hue_prob=0.5),
# 以一定的概率对图像进行高斯模糊
T.RandomBlur(0.1),
# 对图像进行标准化
T.Normalize([0.4848, 0.4435, 0.4023], [0.2744, 0.2688, 0.2757])
])
# 验证集增强
eval_transforms = T.Compose([
T.Resize(
target_size=410,
interp='AREA'),
T.CenterCrop(360),
T.Normalize([0.4848, 0.4435, 0.4023], [0.2744, 0.2688, 0.2757])
])
运行时长:7毫秒结束时间:2023-04-29 13:21:16
(8)、装载数据集
#装载数据集
import paddlex as pdx
train_dataset = pdx.datasets.ImageNet(
data_dir='data/data10954/ImageNetDataset',
file_list='data/data10954/ImageNetDataset/train_list.txt',
label_list='data/data10954/ImageNetDataset/labels.txt',
transforms=train_transforms,
shuffle=True) # 是否需要对数据集中样本打乱顺序
eval_dataset = pdx.datasets.ImageNet(
data_dir='data/data10954/ImageNetDataset',
file_list='data/data10954/ImageNetDataset/val_list.txt',
label_list='data/data10954/ImageNetDataset/labels.txt',
transforms=eval_transforms)
2023-04-29 13:21:22 [INFO] Starting to read file list from dataset... 2023-04-29 13:21:22 [INFO] 1980 samples in file data/data10954/ImageNetDataset/train_list.txt 2023-04-29 13:21:22 [INFO] Starting to read file list from dataset... 2023-04-29 13:21:22 [INFO] 180 samples in file data/data10954/ImageNetDataset/val_list.txt
运行时长:37毫秒结束时间:2023-04-29 13:21:22
(9)、初始化模型
#初始化模型
model = pdx.cls.ResNet101_vd_ssld(
num_classes=len(train_dataset.labels)
)
W0429 05:21:46.169178 184 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 11.2 W0429 05:21:46.173651 184 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
运行时长:196毫秒结束时间:2023-04-29 13:22:38
(10)、模型训练
model.train(
train_dataset=train_dataset,
eval_dataset=eval_dataset,
num_epochs=420, #训练轮数
train_batch_size=80, #一个step所用到的样本量
warmup_steps=(len(train_dataset.file_list) // 80) * 6, #学习率从0经过steps轮迭代增长到设定的学习率
learning_rate=0.025, # 学习率
lr_decay_epochs=[40, 65, 115, 160, 205], #表示学习率在第几个epoch时衰减一次
lr_decay_gamma=0.1, # 学习率衰减率
save_interval_epochs=2, # 每几轮保存一次
log_interval_steps=(len(train_dataset.file_list) // 80) * 7, # 训练日志输出间隔
pretrain_weights='IMAGENET',
#pretrain_weights (str or None): 若指定为'.pdparams'文件时,则从文件加载模型权重;
#若为字符串'IMAGENET',则自动下载在ImageNet图片数据上预训练的模型权重;
#若为None,则不使用预训练模型。默认为'IMAGENET'
save_dir='output/ResNet101_vd_ssld',
use_vdl=False)
运行时长:26毫秒结束时间:2023-04-29 04:33:20
2023-04-29 13:22:47 [INFO] Loading pretrained model from output/ResNet101_vd_ssld/pretrain/ResNet101_vd_ssld_pretrained.pdparams
2023-04-29 13:22:49 [WARNING] [SKIP] Shape of pretrained params fc.weight doesn't match.(Pretrained: (2048, 1000), Actual: [2048, 12])
2023-04-29 13:22:49 [WARNING] [SKIP] Shape of pretrained params fc.bias doesn't match.(Pretrained: (1000,), Actual: [12])
2023-04-29 13:22:49 [INFO] There are 530/532 variables loaded into ResNet101_vd_ssld.
2023-04-29 13:23:20 [INFO] [TRAIN] Epoch 1 finished, loss=2.4181073, acc1=0.18229167, acc5=0.5786458 .
2023-04-29 13:23:48 [INFO] [TRAIN] Epoch 2 finished, loss=1.4139315, acc1=0.6390625, acc5=0.9541667 .
2023-04-29 13:23:48 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:23:50 [INFO] [EVAL] Finished, Epoch=2, acc1=0.900000, acc5=1.000000 .
2023-04-29 13:23:56 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:23:56 [INFO] Current evaluated best model on eval_dataset is epoch_2, acc1=0.9000000357627869
2023-04-29 13:24:01 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_2.
2023-04-29 13:24:29 [INFO] [TRAIN] Epoch 3 finished, loss=0.5691645, acc1=0.81302077, acc5=0.9875 .
2023-04-29 13:24:58 [INFO] [TRAIN] Epoch 4 finished, loss=0.44015732, acc1=0.84427077, acc5=0.9921875 .
2023-04-29 13:24:58 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:25:00 [INFO] [EVAL] Finished, Epoch=4, acc1=0.850000, acc5=1.000000 .
2023-04-29 13:25:00 [INFO] Current evaluated best model on eval_dataset is epoch_2, acc1=0.9000000357627869
2023-04-29 13:25:05 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_4.
2023-04-29 13:25:34 [INFO] [TRAIN] Epoch 5 finished, loss=0.44497904, acc1=0.84375, acc5=0.9890625 .
2023-04-29 13:26:02 [INFO] [TRAIN] Epoch 6 finished, loss=0.4761262, acc1=0.8322916, acc5=0.9875 .
2023-04-29 13:26:02 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:26:04 [INFO] [EVAL] Finished, Epoch=6, acc1=0.908333, acc5=0.995833 .
2023-04-29 13:26:10 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:26:10 [INFO] Current evaluated best model on eval_dataset is epoch_6, acc1=0.9083333015441895
2023-04-29 13:26:17 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_6.
2023-04-29 13:26:45 [INFO] [TRAIN] Epoch=7/100, Step=24/24, loss=0.607006, acc1=0.812500, acc5=0.987500, lr=0.025000, time_each_step=1.19s, eta=0:51:10
2023-04-29 13:26:45 [INFO] [TRAIN] Epoch 7 finished, loss=0.4677044, acc1=0.8328125, acc5=0.9890625 .
2023-04-29 13:27:14 [INFO] [TRAIN] Epoch 8 finished, loss=0.44583225, acc1=0.8421876, acc5=0.9848959 .
2023-04-29 13:27:14 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:27:16 [INFO] [EVAL] Finished, Epoch=8, acc1=0.941667, acc5=0.995833 .
2023-04-29 13:27:23 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:27:23 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:27:29 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_8.
2023-04-29 13:27:58 [INFO] [TRAIN] Epoch 9 finished, loss=0.39136004, acc1=0.8625, acc5=0.9901042 .
2023-04-29 13:28:26 [INFO] [TRAIN] Epoch 10 finished, loss=0.4166825, acc1=0.8484375, acc5=0.99010414 .
2023-04-29 13:28:26 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:28:28 [INFO] [EVAL] Finished, Epoch=10, acc1=0.920833, acc5=1.000000 .
2023-04-29 13:28:28 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:28:31 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_10.
2023-04-29 13:28:59 [INFO] [TRAIN] Epoch 11 finished, loss=0.31962064, acc1=0.88593745, acc5=0.9911458 .
2023-04-29 13:29:28 [INFO] [TRAIN] Epoch 12 finished, loss=0.3115134, acc1=0.8885417, acc5=0.99062496 .
2023-04-29 13:29:28 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:29:30 [INFO] [EVAL] Finished, Epoch=12, acc1=0.933333, acc5=1.000000 .
2023-04-29 13:29:30 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:29:33 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_12.
2023-04-29 13:30:01 [INFO] [TRAIN] Epoch 13 finished, loss=0.31692782, acc1=0.8911459, acc5=0.9911458 .
2023-04-29 13:30:29 [INFO] [TRAIN] Epoch=14/100, Step=24/24, loss=0.245570, acc1=0.912500, acc5=0.987500, lr=0.025000, time_each_step=1.18s, eta=0:42:2
2023-04-29 13:30:30 [INFO] [TRAIN] Epoch 14 finished, loss=0.2632157, acc1=0.909375, acc5=0.9927084 .
2023-04-29 13:30:30 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:30:32 [INFO] [EVAL] Finished, Epoch=14, acc1=0.925000, acc5=0.991667 .
2023-04-29 13:30:32 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:30:35 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_14.
2023-04-29 13:31:03 [INFO] [TRAIN] Epoch 15 finished, loss=0.2779355, acc1=0.9072917, acc5=0.9875 .
2023-04-29 13:31:32 [INFO] [TRAIN] Epoch 16 finished, loss=0.2853838, acc1=0.9010417, acc5=0.99114585 .
2023-04-29 13:31:32 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:31:34 [INFO] [EVAL] Finished, Epoch=16, acc1=0.937500, acc5=1.000000 .
2023-04-29 13:31:34 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:31:37 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_16.
2023-04-29 13:32:05 [INFO] [TRAIN] Epoch 17 finished, loss=0.26465186, acc1=0.90937495, acc5=0.99322915 .
2023-04-29 13:32:34 [INFO] [TRAIN] Epoch 18 finished, loss=0.27762282, acc1=0.9036458, acc5=0.9947917 .
2023-04-29 13:32:34 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:32:36 [INFO] [EVAL] Finished, Epoch=18, acc1=0.933333, acc5=0.995833 .
2023-04-29 13:32:36 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:32:39 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_18.
2023-04-29 13:33:07 [INFO] [TRAIN] Epoch 19 finished, loss=0.258658, acc1=0.9114583, acc5=0.99375004 .
2023-04-29 13:33:36 [INFO] [TRAIN] Epoch 20 finished, loss=0.25491306, acc1=0.9151042, acc5=0.9953125 .
2023-04-29 13:33:36 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:33:38 [INFO] [EVAL] Finished, Epoch=20, acc1=0.937500, acc5=1.000000 .
2023-04-29 13:33:38 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:33:40 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_20.
2023-04-29 13:34:09 [INFO] [TRAIN] Epoch=21/100, Step=24/24, loss=0.299951, acc1=0.887500, acc5=1.000000, lr=0.025000, time_each_step=1.18s, eta=0:38:48
2023-04-29 13:34:09 [INFO] [TRAIN] Epoch 21 finished, loss=0.23813273, acc1=0.921875, acc5=0.99322915 .
2023-04-29 13:34:37 [INFO] [TRAIN] Epoch 22 finished, loss=0.2311691, acc1=0.9208333, acc5=0.9942708 .
2023-04-29 13:34:37 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:34:39 [INFO] [EVAL] Finished, Epoch=22, acc1=0.941667, acc5=0.995833 .
2023-04-29 13:34:39 [INFO] Current evaluated best model on eval_dataset is epoch_8, acc1=0.9416666626930237
2023-04-29 13:34:45 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_22.
2023-04-29 13:35:13 [INFO] [TRAIN] Epoch 23 finished, loss=0.24179737, acc1=0.92031246, acc5=0.9921875 .
2023-04-29 13:35:42 [INFO] [TRAIN] Epoch 24 finished, loss=0.2174315, acc1=0.93020827, acc5=0.9953125 .
2023-04-29 13:35:42 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:35:44 [INFO] [EVAL] Finished, Epoch=24, acc1=0.958333, acc5=0.995833 .
2023-04-29 13:35:47 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:35:47 [INFO] Current evaluated best model on eval_dataset is epoch_24, acc1=0.9583333134651184
2023-04-29 13:35:50 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_24.
2023-04-29 13:36:18 [INFO] [TRAIN] Epoch 25 finished, loss=0.23656587, acc1=0.9161458, acc5=0.99270827 .
2023-04-29 13:36:47 [INFO] [TRAIN] Epoch 26 finished, loss=0.17985408, acc1=0.9348958, acc5=0.99322915 .
2023-04-29 13:36:47 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:36:49 [INFO] [EVAL] Finished, Epoch=26, acc1=0.958333, acc5=0.995833 .
2023-04-29 13:36:49 [INFO] Current evaluated best model on eval_dataset is epoch_24, acc1=0.9583333134651184
2023-04-29 13:36:52 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_26.
2023-04-29 13:37:20 [INFO] [TRAIN] Epoch 27 finished, loss=0.21032478, acc1=0.9317708, acc5=0.9921875 .
2023-04-29 13:37:48 [INFO] [TRAIN] Epoch=28/100, Step=24/24, loss=0.137395, acc1=0.962500, acc5=1.000000, lr=0.025000, time_each_step=1.18s, eta=0:35:17
2023-04-29 13:37:48 [INFO] [TRAIN] Epoch 28 finished, loss=0.19942836, acc1=0.9317708, acc5=0.9937499 .
2023-04-29 13:37:48 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:37:50 [INFO] [EVAL] Finished, Epoch=28, acc1=0.962500, acc5=0.995833 .
2023-04-29 13:37:53 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:37:53 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:37:56 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_28.
2023-04-29 13:38:24 [INFO] [TRAIN] Epoch 29 finished, loss=0.18137391, acc1=0.93333334, acc5=0.9947917 .
2023-04-29 13:38:52 [INFO] [TRAIN] Epoch 30 finished, loss=0.22040725, acc1=0.9223959, acc5=0.9927084 .
2023-04-29 13:38:52 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:38:54 [INFO] [EVAL] Finished, Epoch=30, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:38:54 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:38:57 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_30.
2023-04-29 13:39:26 [INFO] [TRAIN] Epoch 31 finished, loss=0.18553962, acc1=0.93541664, acc5=0.9942708 .
2023-04-29 13:39:54 [INFO] [TRAIN] Epoch 32 finished, loss=0.1747637, acc1=0.94427085, acc5=0.9937499 .
2023-04-29 13:39:54 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:39:56 [INFO] [EVAL] Finished, Epoch=32, acc1=0.962500, acc5=1.000000 .
2023-04-29 13:39:56 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:39:59 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_32.
2023-04-29 13:40:27 [INFO] [TRAIN] Epoch 33 finished, loss=0.21876918, acc1=0.9270833, acc5=0.9942708 .
2023-04-29 13:40:55 [INFO] [TRAIN] Epoch 34 finished, loss=0.18000536, acc1=0.9395833, acc5=0.99270827 .
2023-04-29 13:40:55 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:40:57 [INFO] [EVAL] Finished, Epoch=34, acc1=0.941667, acc5=1.000000 .
2023-04-29 13:40:57 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:41:00 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_34.
2023-04-29 13:41:28 [INFO] [TRAIN] Epoch=35/100, Step=24/24, loss=0.168058, acc1=0.950000, acc5=1.000000, lr=0.025000, time_each_step=1.18s, eta=0:31:46
2023-04-29 13:41:28 [INFO] [TRAIN] Epoch 35 finished, loss=0.18160756, acc1=0.9375, acc5=0.99322915 .
2023-04-29 13:41:57 [INFO] [TRAIN] Epoch 36 finished, loss=0.15345208, acc1=0.95104164, acc5=0.996875 .
2023-04-29 13:41:57 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:41:59 [INFO] [EVAL] Finished, Epoch=36, acc1=0.945833, acc5=0.995833 .
2023-04-29 13:41:59 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:42:02 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_36.
2023-04-29 13:42:30 [INFO] [TRAIN] Epoch 37 finished, loss=0.17318165, acc1=0.940625, acc5=0.99635416 .
2023-04-29 13:42:59 [INFO] [TRAIN] Epoch 38 finished, loss=0.1635019, acc1=0.9458334, acc5=0.9947917 .
2023-04-29 13:42:59 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:43:01 [INFO] [EVAL] Finished, Epoch=38, acc1=0.962500, acc5=0.995833 .
2023-04-29 13:43:01 [INFO] Current evaluated best model on eval_dataset is epoch_28, acc1=0.9625000357627869
2023-04-29 13:43:03 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_38.
2023-04-29 13:43:32 [INFO] [TRAIN] Epoch 39 finished, loss=0.17445272, acc1=0.9401042, acc5=0.9942708 .
2023-04-29 13:44:00 [INFO] [TRAIN] Epoch 40 finished, loss=0.18280022, acc1=0.9385417, acc5=0.9947917 .
2023-04-29 13:44:00 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:44:02 [INFO] [EVAL] Finished, Epoch=40, acc1=0.966667, acc5=0.995833 .
2023-04-29 13:44:05 [INFO] Model saved in output/ResNet101_vd_ssld/best_model.
2023-04-29 13:44:05 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:44:08 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_40.
2023-04-29 13:44:36 [INFO] [TRAIN] Epoch 41 finished, loss=0.18835509, acc1=0.9328125, acc5=0.9932292 .
2023-04-29 13:45:04 [INFO] [TRAIN] Epoch=42/100, Step=24/24, loss=0.164039, acc1=0.950000, acc5=1.000000, lr=0.025000, time_each_step=1.18s, eta=0:29:42
2023-04-29 13:45:04 [INFO] [TRAIN] Epoch 42 finished, loss=0.1939249, acc1=0.9322917, acc5=0.9942708 .
2023-04-29 13:45:04 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:45:06 [INFO] [EVAL] Finished, Epoch=42, acc1=0.954167, acc5=1.000000 .
2023-04-29 13:45:06 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:45:09 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_42.
2023-04-29 13:45:37 [INFO] [TRAIN] Epoch 43 finished, loss=0.158045, acc1=0.9432292, acc5=0.9927084 .
2023-04-29 13:46:06 [INFO] [TRAIN] Epoch 44 finished, loss=0.16796286, acc1=0.9390624, acc5=0.9973958 .
2023-04-29 13:46:06 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:46:08 [INFO] [EVAL] Finished, Epoch=44, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:46:08 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:46:10 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_44.
2023-04-29 13:46:39 [INFO] [TRAIN] Epoch 45 finished, loss=0.13306127, acc1=0.9479167, acc5=0.996875 .
2023-04-29 13:47:07 [INFO] [TRAIN] Epoch 46 finished, loss=0.17995667, acc1=0.93906254, acc5=0.9942708 .
2023-04-29 13:47:07 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:47:10 [INFO] [EVAL] Finished, Epoch=46, acc1=0.945833, acc5=1.000000 .
2023-04-29 13:47:10 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:47:14 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_46.
2023-04-29 13:47:42 [INFO] [TRAIN] Epoch 47 finished, loss=0.15355453, acc1=0.94947916, acc5=0.996875 .
2023-04-29 13:48:11 [INFO] [TRAIN] Epoch 48 finished, loss=0.12802142, acc1=0.9619792, acc5=0.9979167 .
2023-04-29 13:48:11 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:48:13 [INFO] [EVAL] Finished, Epoch=48, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:48:13 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:48:16 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_48.
2023-04-29 13:48:44 [INFO] [TRAIN] Epoch=49/100, Step=24/24, loss=0.168833, acc1=0.937500, acc5=0.987500, lr=0.002500, time_each_step=1.18s, eta=0:25:4
2023-04-29 13:48:44 [INFO] [TRAIN] Epoch 49 finished, loss=0.1222587, acc1=0.9536459, acc5=0.9963541 .
2023-04-29 13:49:12 [INFO] [TRAIN] Epoch 50 finished, loss=0.11258652, acc1=0.96250004, acc5=0.9979167 .
2023-04-29 13:49:13 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:49:15 [INFO] [EVAL] Finished, Epoch=50, acc1=0.958333, acc5=0.995833 .
2023-04-29 13:49:15 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:49:17 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_50.
2023-04-29 13:49:46 [INFO] [TRAIN] Epoch 51 finished, loss=0.10442413, acc1=0.9635417, acc5=0.99583334 .
2023-04-29 13:50:14 [INFO] [TRAIN] Epoch 52 finished, loss=0.105671056, acc1=0.9640625, acc5=0.996875 .
2023-04-29 13:50:14 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:50:16 [INFO] [EVAL] Finished, Epoch=52, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:50:16 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:50:21 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_52.
2023-04-29 13:50:49 [INFO] [TRAIN] Epoch 53 finished, loss=0.099631034, acc1=0.9661458, acc5=0.99583334 .
2023-04-29 13:51:18 [INFO] [TRAIN] Epoch 54 finished, loss=0.08079084, acc1=0.9744792, acc5=0.99843746 .
2023-04-29 13:51:18 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:51:20 [INFO] [EVAL] Finished, Epoch=54, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:51:20 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:51:25 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_54.
2023-04-29 13:51:54 [INFO] [TRAIN] Epoch 55 finished, loss=0.08740174, acc1=0.96562505, acc5=0.99895835 .
2023-04-29 13:52:22 [INFO] [TRAIN] Epoch=56/100, Step=24/24, loss=0.081490, acc1=0.975000, acc5=0.987500, lr=0.002500, time_each_step=1.18s, eta=0:21:34
2023-04-29 13:52:22 [INFO] [TRAIN] Epoch 56 finished, loss=0.09467447, acc1=0.96718746, acc5=0.9994791 .
2023-04-29 13:52:22 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:52:24 [INFO] [EVAL] Finished, Epoch=56, acc1=0.950000, acc5=0.995833 .
2023-04-29 13:52:24 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:52:29 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_56.
2023-04-29 13:52:58 [INFO] [TRAIN] Epoch 57 finished, loss=0.08061715, acc1=0.97239584, acc5=0.9984376 .
2023-04-29 13:53:26 [INFO] [TRAIN] Epoch 58 finished, loss=0.096425116, acc1=0.96875, acc5=0.9947917 .
2023-04-29 13:53:26 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:53:28 [INFO] [EVAL] Finished, Epoch=58, acc1=0.954167, acc5=0.995833 .
2023-04-29 13:53:28 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:53:34 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_58.
2023-04-29 13:54:02 [INFO] [TRAIN] Epoch 59 finished, loss=0.09276194, acc1=0.9682291, acc5=0.9984376 .
2023-04-29 13:54:30 [INFO] [TRAIN] Epoch 60 finished, loss=0.08393594, acc1=0.971875, acc5=0.9979167 .
2023-04-29 13:54:30 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:54:32 [INFO] [EVAL] Finished, Epoch=60, acc1=0.954167, acc5=0.995833 .
2023-04-29 13:54:32 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:54:38 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_60.
2023-04-29 13:55:06 [INFO] [TRAIN] Epoch 61 finished, loss=0.07893957, acc1=0.9739583, acc5=0.9973958 .
2023-04-29 13:55:35 [INFO] [TRAIN] Epoch 62 finished, loss=0.095089525, acc1=0.9713542, acc5=0.99635416 .
2023-04-29 13:55:35 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:55:37 [INFO] [EVAL] Finished, Epoch=62, acc1=0.954167, acc5=1.000000 .
2023-04-29 13:55:37 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:55:42 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_62.
2023-04-29 13:56:10 [INFO] [TRAIN] Epoch=63/100, Step=24/24, loss=0.020284, acc1=1.000000, acc5=1.000000, lr=0.002500, time_each_step=1.18s, eta=0:18:10
2023-04-29 13:56:10 [INFO] [TRAIN] Epoch 63 finished, loss=0.0862158, acc1=0.96875, acc5=0.996875 .
2023-04-29 13:56:39 [INFO] [TRAIN] Epoch 64 finished, loss=0.08045288, acc1=0.9739583, acc5=0.9973958 .
2023-04-29 13:56:39 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:56:41 [INFO] [EVAL] Finished, Epoch=64, acc1=0.954167, acc5=1.000000 .
2023-04-29 13:56:41 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:56:46 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_64.
2023-04-29 13:57:15 [INFO] [TRAIN] Epoch 65 finished, loss=0.07768077, acc1=0.97343755, acc5=0.99895835 .
2023-04-29 13:57:43 [INFO] [TRAIN] Epoch 66 finished, loss=0.079841435, acc1=0.9755208, acc5=0.9979167 .
2023-04-29 13:57:43 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:57:45 [INFO] [EVAL] Finished, Epoch=66, acc1=0.958333, acc5=0.995833 .
2023-04-29 13:57:45 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:57:51 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_66.
2023-04-29 13:58:19 [INFO] [TRAIN] Epoch 67 finished, loss=0.09812697, acc1=0.9635417, acc5=0.9979167 .
2023-04-29 13:58:47 [INFO] [TRAIN] Epoch 68 finished, loss=0.0780992, acc1=0.9734375, acc5=0.9973958 .
2023-04-29 13:58:48 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:58:50 [INFO] [EVAL] Finished, Epoch=68, acc1=0.958333, acc5=0.995833 .
2023-04-29 13:58:50 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:58:55 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_68.
2023-04-29 13:59:23 [INFO] [TRAIN] Epoch 69 finished, loss=0.06367198, acc1=0.9765625, acc5=0.9984376 .
2023-04-29 13:59:52 [INFO] [TRAIN] Epoch=70/100, Step=24/24, loss=0.024267, acc1=0.987500, acc5=1.000000, lr=0.002500, time_each_step=1.18s, eta=0:14:38
2023-04-29 13:59:52 [INFO] [TRAIN] Epoch 70 finished, loss=0.06689284, acc1=0.9734375, acc5=0.9973958 .
2023-04-29 13:59:52 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 13:59:54 [INFO] [EVAL] Finished, Epoch=70, acc1=0.962500, acc5=0.995833 .
2023-04-29 13:59:54 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 13:59:59 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_70.
2023-04-29 14:00:28 [INFO] [TRAIN] Epoch 71 finished, loss=0.08160842, acc1=0.971875, acc5=0.9979167 .
2023-04-29 14:00:56 [INFO] [TRAIN] Epoch 72 finished, loss=0.068439595, acc1=0.97812504, acc5=0.9973958 .
2023-04-29 14:00:56 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:00:58 [INFO] [EVAL] Finished, Epoch=72, acc1=0.958333, acc5=0.995833 .
2023-04-29 14:00:58 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:01:04 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_72.
2023-04-29 14:01:32 [INFO] [TRAIN] Epoch 73 finished, loss=0.06792923, acc1=0.9776042, acc5=0.9984376 .
2023-04-29 14:02:01 [INFO] [TRAIN] Epoch 74 finished, loss=0.07590193, acc1=0.97552085, acc5=0.9984376 .
2023-04-29 14:02:01 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:02:03 [INFO] [EVAL] Finished, Epoch=74, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:02:03 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:02:06 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_74.
2023-04-29 14:02:34 [INFO] [TRAIN] Epoch 75 finished, loss=0.09295172, acc1=0.9661458, acc5=0.99322915 .
2023-04-29 14:03:03 [INFO] [TRAIN] Epoch 76 finished, loss=0.075549096, acc1=0.9750001, acc5=0.99635416 .
2023-04-29 14:03:03 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:03:05 [INFO] [EVAL] Finished, Epoch=76, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:03:05 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:03:09 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_76.
2023-04-29 14:03:37 [INFO] [TRAIN] Epoch=77/100, Step=24/24, loss=0.061007, acc1=0.975000, acc5=1.000000, lr=0.000250, time_each_step=1.18s, eta=0:11:16
2023-04-29 14:03:37 [INFO] [TRAIN] Epoch 77 finished, loss=0.07366269, acc1=0.971875, acc5=0.9994791 .
2023-04-29 14:04:05 [INFO] [TRAIN] Epoch 78 finished, loss=0.07251313, acc1=0.9770834, acc5=0.9973958 .
2023-04-29 14:04:05 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:04:07 [INFO] [EVAL] Finished, Epoch=78, acc1=0.958333, acc5=0.995833 .
2023-04-29 14:04:07 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:04:10 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_78.
2023-04-29 14:04:38 [INFO] [TRAIN] Epoch 79 finished, loss=0.07673622, acc1=0.9765625, acc5=0.9958334 .
2023-04-29 14:05:06 [INFO] [TRAIN] Epoch 80 finished, loss=0.068322025, acc1=0.9786458, acc5=0.9984376 .
2023-04-29 14:05:07 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:05:09 [INFO] [EVAL] Finished, Epoch=80, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:05:09 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:05:14 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_80.
2023-04-29 14:05:43 [INFO] [TRAIN] Epoch 81 finished, loss=0.081926815, acc1=0.97239584, acc5=0.9973958 .
2023-04-29 14:06:11 [INFO] [TRAIN] Epoch 82 finished, loss=0.07687502, acc1=0.97499996, acc5=0.9973958 .
2023-04-29 14:06:11 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:06:13 [INFO] [EVAL] Finished, Epoch=82, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:06:13 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:06:18 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_82.
2023-04-29 14:06:46 [INFO] [TRAIN] Epoch 83 finished, loss=0.076094665, acc1=0.9744792, acc5=0.996875 .
2023-04-29 14:07:14 [INFO] [TRAIN] Epoch=84/100, Step=24/24, loss=0.025069, acc1=0.987500, acc5=1.000000, lr=0.000250, time_each_step=1.18s, eta=0:7:48
2023-04-29 14:07:14 [INFO] [TRAIN] Epoch 84 finished, loss=0.07510537, acc1=0.97552085, acc5=0.99635416 .
2023-04-29 14:07:15 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:07:17 [INFO] [EVAL] Finished, Epoch=84, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:07:17 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:07:20 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_84.
2023-04-29 14:07:48 [INFO] [TRAIN] Epoch 85 finished, loss=0.08195982, acc1=0.97239584, acc5=0.9963541 .
2023-04-29 14:08:16 [INFO] [TRAIN] Epoch 86 finished, loss=0.07372735, acc1=0.97239584, acc5=0.9979167 .
2023-04-29 14:08:16 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:08:18 [INFO] [EVAL] Finished, Epoch=86, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:08:18 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:08:21 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_86.
2023-04-29 14:08:49 [INFO] [TRAIN] Epoch 87 finished, loss=0.06814042, acc1=0.9776042, acc5=0.9984376 .
2023-04-29 14:09:18 [INFO] [TRAIN] Epoch 88 finished, loss=0.0976159, acc1=0.9703124, acc5=0.996875 .
2023-04-29 14:09:18 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:09:20 [INFO] [EVAL] Finished, Epoch=88, acc1=0.954167, acc5=0.995833 .
2023-04-29 14:09:20 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:09:24 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_88.
2023-04-29 14:09:53 [INFO] [TRAIN] Epoch 89 finished, loss=0.055377375, acc1=0.98072916, acc5=0.9979167 .
2023-04-29 14:10:21 [INFO] [TRAIN] Epoch 90 finished, loss=0.07136932, acc1=0.9744792, acc5=0.9979167 .
2023-04-29 14:10:21 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:10:23 [INFO] [EVAL] Finished, Epoch=90, acc1=0.954167, acc5=1.000000 .
2023-04-29 14:10:23 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:10:29 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_90.
2023-04-29 14:10:57 [INFO] [TRAIN] Epoch=91/100, Step=24/24, loss=0.012872, acc1=1.000000, acc5=1.000000, lr=0.000250, time_each_step=1.18s, eta=0:4:24
2023-04-29 14:10:57 [INFO] [TRAIN] Epoch 91 finished, loss=0.07514046, acc1=0.9739583, acc5=0.99895835 .
2023-04-29 14:11:25 [INFO] [TRAIN] Epoch 92 finished, loss=0.08457449, acc1=0.9677084, acc5=0.99895835 .
2023-04-29 14:11:25 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:11:27 [INFO] [EVAL] Finished, Epoch=92, acc1=0.958333, acc5=1.000000 .
2023-04-29 14:11:27 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:11:30 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_92.
2023-04-29 14:11:58 [INFO] [TRAIN] Epoch 93 finished, loss=0.06884056, acc1=0.9802084, acc5=0.9984376 .
2023-04-29 14:12:27 [INFO] [TRAIN] Epoch 94 finished, loss=0.09393544, acc1=0.9682291, acc5=0.99635416 .
2023-04-29 14:12:27 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:12:29 [INFO] [EVAL] Finished, Epoch=94, acc1=0.958333, acc5=1.000000 .
2023-04-29 14:12:29 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:12:31 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_94.
2023-04-29 14:12:59 [INFO] [TRAIN] Epoch 95 finished, loss=0.066801436, acc1=0.97812504, acc5=0.9984376 .
2023-04-29 14:13:28 [INFO] [TRAIN] Epoch 96 finished, loss=0.08267576, acc1=0.9713542, acc5=0.9979167 .
2023-04-29 14:13:28 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:13:30 [INFO] [EVAL] Finished, Epoch=96, acc1=0.954167, acc5=1.000000 .
2023-04-29 14:13:30 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:13:33 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_96.
2023-04-29 14:14:01 [INFO] [TRAIN] Epoch 97 finished, loss=0.07954182, acc1=0.9708333, acc5=0.99895835 .
2023-04-29 14:14:29 [INFO] [TRAIN] Epoch=98/100, Step=24/24, loss=0.131309, acc1=0.962500, acc5=1.000000, lr=0.000250, time_each_step=1.18s, eta=0:0:58
2023-04-29 14:14:29 [INFO] [TRAIN] Epoch 98 finished, loss=0.07684819, acc1=0.9765625, acc5=0.996875 .
2023-04-29 14:14:30 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:14:32 [INFO] [EVAL] Finished, Epoch=98, acc1=0.958333, acc5=0.995833 .
2023-04-29 14:14:32 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:14:34 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_98.
2023-04-29 14:15:02 [INFO] [TRAIN] Epoch 99 finished, loss=0.08056358, acc1=0.96875, acc5=0.996875 .
2023-04-29 14:15:31 [INFO] [TRAIN] Epoch 100 finished, loss=0.08144415, acc1=0.9760416, acc5=0.99635416 .
2023-04-29 14:15:31 [INFO] Start to evaluate(total_samples=180, total_steps=3)...
2023-04-29 14:15:33 [INFO] [EVAL] Finished, Epoch=100, acc1=0.958333, acc5=0.995833 .
2023-04-29 14:15:33 [INFO] Current evaluated best model on eval_dataset is epoch_40, acc1=0.9666666984558105
2023-04-29 14:15:36 [INFO] Model saved in output/ResNet101_vd_ssld/epoch_100.
运行时长:3168.472秒结束时间:2023-04-29 14:15:36
import paddlex as pdx
#model = pdx.load_model('output/ResNet101_vd_ssld/epoch_40') # 加载模型
model = pdx.load_model('/home/aistudio/output/ResNet101_vd_ssld/best_model/model.yml') # 加载模型
model.get_model_info() # 显示信息
(11)、生成 result.csv
#生成 work/result.csv
import glob
test_list = glob.glob('data/data10954/cat_12_test/*.jpg')
test_df = pd.DataFrame() # 创建表结构
for i in range(len(test_list)):
img = Image.open(test_list[i]).convert('RGB')
img = np.asarray(img, dtype='float32') # 转换数据类型
result = model.predict(img[:, :, [2, 1, 0]]) # 预测结果
test_df.at[i, 'name'] = str(test_list[i]).split('/')[-1] # 文件名
test_df.at[i, 'cls'] = int(result[0]['category_id']) # 类别
test_df[['name']] = test_df[['name']].astype(str)
test_df[['cls']] = test_df[['cls']].astype(int)
test_df.to_csv('work/result.csv', index=False, header=False) # 生成csv文件
test_df.head()
name | cls | |
---|---|---|
0 | aJfHX1egSQnbujLyYpxITv3iPd0CBF98.jpg | 5 |
1 | xS3d4XNZ2YGRtaBH6TCVbmJvghiOlAIQ.jpg | 8 |
2 | xSJLM7Z4fQRdz809DjcvClUnXopymPwt.jpg | 2 |
3 | P8r4NWa3wQ7OIp9jzbDfteBgxdYKAGEL.jpg | 9 |
4 | 8TMA06Nnzor2Gfei5H1h3svPYX4uVSmD.jpg | 3 |
运行时长:16.529秒结束时间:2023-04-29 14:33:19
提交submit.csv,得分0.9375
name | cls | |
---|---|---|
0 | aJfHX1egSQnbujLyYpxITv3iPd0CBF98.jpg | 5 |
1 | xS3d4XNZ2YGRtaBH6TCVbmJvghiOlAIQ.jpg | 8 |
2 | xSJLM7Z4fQRdz809DjcvClUnXopymPwt.jpg | 2 |
3 | P8r4NWa3wQ7OIp9jzbDfteBgxdYKAGEL.jpg | 9 |
4 | 8TMA06Nnzor2Gfei5H1h3svPYX4uVSmD.jpg | 3 |
运行时长:18.988秒结束时间:2023-04-29 15:47:24
0.95
name | cls | |
---|---|---|
0 | aJfHX1egSQnbujLyYpxITv3iPd0CBF98.jpg | 5 |
1 | xS3d4XNZ2YGRtaBH6TCVbmJvghiOlAIQ.jpg | 8 |
2 | xSJLM7Z4fQRdz809DjcvClUnXopymPwt.jpg | 8 |
3 | P8r4NWa3wQ7OIp9jzbDfteBgxdYKAGEL.jpg | 5 |
4 | 8TMA06Nnzor2Gfei5H1h3svPYX4uVSmD.jpg | 5 |
运行时长:16.367秒结束时间:2023-04-29 18:10:11
四、总结
图像分类顾名思义就是一个模式分类问题,它的目标是将不同的图像,划分到不同的类别,实现最小的分类误差。
图像分类是计算机视觉中最基础的任务,基本上深度学习模型的发展史就是图像分类任务提升的发展历史,不过图像分类并不是那么简单,也没有被完全解决。图像分类是计算机视觉中最基础的一个任务,也是几乎所有的基准模型进行比较的任务。这里面还有很多需要继续学习的地方。
训练模型时需要注意次数,100次训练得分0.9375,训练350次得分0.41667
五、参考资料
基线项目,由飞桨PPDE一心炼银提供
https://aistudio.baidu.com/aistudio/projectdetail/4243146
baseline 视频解析
https://pan.baidu.com/s/1f3UauRYlenFeB3XJGSIZDg
提取码:yinx
项目:https://aistudio.baidu.com/aistudio/projectdetail/3461935
项目:https://aistudio.baidu.com/aistudio/projectdetail/3906013
项目:https://blog.csdn.net/m0_63642362/article/details/128005486
项目:https://blog.csdn.net/m0_63642362/article/details/128005486
项目:https://blog.csdn.net/weixin_45014721/article/details/120887871
项目:https://blog.csdn.net/weixin_52263256/article/details/130176944
使用Resnet残差网络对图像进行分类(猫十二分类,模型定义、训练、保存、预测)(一)
推荐阅读:
| | |
给照片换底色(python+opencv) | ||
| | |
计算机视觉__基本图像操作(显示、读取、保存) | 直方图(颜色直方图、灰度直方图) | 直方图均衡化(调节图像亮度、对比度) |
| | |
| ||
| ||
Three.js实例详解___旋转的精灵女孩(附完整代码和资源)(一) | ||
| | |
立体多层玫瑰绘图源码__玫瑰花python 绘图源码集锦 | ||
| | |
用代码写出浪漫__合集(python、matplotlib、Matlab、java绘制爱心、玫瑰花、前端特效玫瑰、爱心) | python爱心源代码集锦(18款) | |
| | |
| | |
用代码过中秋,python海龟月饼你要不要尝一口? | ||
| | |
草莓熊python turtle绘图(风车版)附源代码 | ||
| | |
皮卡丘python turtle海龟绘图(电力球版)附源代码 | ||
| | |
2023年4月多家权威机构____编程语言排行榜__薪酬状况 | ||
| | |
【CSDN云IDE】个人使用体验和建议(含超详细操作教程)(python、webGL方向) | ||
| | |