python-Vision Transformer实现行为分类和模型类激活图CAM绘制【源码分享】

1、注:源码放置文末

1.1 环境配置要求:https://blog.csdn.net/qq_42279468/article/details/124987801

2、展示效果:

 https://www.bilibili.com/video/BV1mv4y157ms/

3、代码

python-Vision Transformer实现行为分类和模型类激活图CAM绘制【源码分享】_第1张图片

  本项目通过python实现vision Transformer模型实现行为分类,模型训练,测试,以及可视化,包括CAM图绘制。

3.1 数据集展示

3.2 模型训练过程

221 images were found in the dataset.
178 images for training.
43 images for validation.
Using 2 dataloader workers every process
<All keys matched successfully>
training head.weight
training head.bias
[train epoch 0] loss: 0.535, acc: 0.933: 100%|██████████| 89/89 [00:08<00:00, 10.99it/s]
[valid epoch 0] loss: 0.000, acc: 0.958: 100%|██████████| 22/22 [00:03<00:00,  7.29it/s]
[train epoch 1] loss: 0.083, acc: 0.994: 100%|██████████| 89/89 [00:06<00:00, 13.88it/s]

3.3 模型测试

python-Vision Transformer实现行为分类和模型类激活图CAM绘制【源码分享】_第2张图片

class: run          prob: 1.0
class: shuaidao     prob: 1.8e-17
class: walk         prob: 1.18e-19
class: wangqiu      prob: 1.33e-16

3.4 CAM类激活图绘制

python-Vision Transformer实现行为分类和模型类激活图CAM绘制【源码分享】_第3张图片

4 源码下载

https://download.csdn.net/download/qq_42279468/87611105

你可能感兴趣的:(副业1,python,transformer,分类,深度学习)