首页
/ ActionCLIP 开源项目使用教程

ActionCLIP 开源项目使用教程

2026-01-17 08:46:25作者:宣聪麟

1. 项目的目录结构及介绍

ActionCLIP/
├── configs/
│   ├── default_runtime.py
│   ├── _base_/
│   │   ├── datasets.py
│   │   ├── models.py
│   │   ├── schedules.py
│   │   └── default_runtime.py
│   ├── actionclip/
│   │   ├── vit-b-16.py
│   │   └── vit-b-32.py
├── data/
│   ├── annotations/
│   ├── checkpoints/
│   ├── datasets/
│   └── transforms/
├── models/
│   ├── backbones/
│   ├── heads/
│   ├── necks/
│   └── utils/
├── tools/
│   ├── train.py
│   ├── test.py
│   └── inference.py
├── README.md
├── requirements.txt
└── setup.py

目录结构介绍

  • configs/: 包含项目的配置文件,定义了模型、数据集、训练和评估的参数。
    • default_runtime.py: 默认运行时配置。
    • base/: 基础配置文件,包括数据集、模型、训练计划和默认运行时配置。
    • actionclip/: 特定于ActionCLIP的配置文件。
  • data/: 数据相关文件,包括标注文件、预训练模型、数据集和数据转换。
  • models/: 模型相关文件,包括骨干网络、头部、颈部和工具。
  • tools/: 工具脚本,包括训练、测试和推理脚本。
  • README.md: 项目说明文档。
  • requirements.txt: 项目依赖文件。
  • setup.py: 项目安装脚本。

2. 项目的启动文件介绍

训练脚本

python tools/train.py configs/actionclip/vit-b-16.py

测试脚本

python tools/test.py configs/actionclip/vit-b-16.py

推理脚本

python tools/inference.py configs/actionclip/vit-b-16.py

3. 项目的配置文件介绍

配置文件路径

configs/actionclip/vit-b-16.py

配置文件内容示例

# 数据集配置
dataset_type = 'CustomDataset'
data_root = 'data/custom_dataset/'
img_norm_cfg = dict(
    mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='RandomResizedCrop', size=224),
    dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='ImageToTensor', keys=['img']),
    dict(type='ToTensor', keys=['gt_label']),
    dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='Resize', size=(256, -1)),
    dict(type='CenterCrop', crop_size=224),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='ImageToTensor', keys=['img']),
    dict(type='Collect', keys=['img'])
]
data = dict(
    samples_per_gpu=32,
    workers_per_gpu=2,
    train=dict(
        type=dataset_type,
        data_prefix='train',
        ann_file=data_root + 'train.txt',
        pipeline=train_pipeline),
    val=dict(
        type=dataset_type,
        data_prefix='val',
        ann_file=data_root + 'val.txt',
        pipeline=test_pipeline),
    test=dict(
        type=dataset_type,
        data_prefix='test
登录后查看全文
热门项目推荐
相关项目推荐