TrajectoryCrafter 来自论文 TrajectoryCrafter: Redirecting Camera Trajectory for Monocular Videos via Diffusion Models,是一种用于单目视频相机轨迹重定向的扩散模型。
该模型通过扩散模型学习视频中的相机轨迹,可以实现相机轨迹的编辑和重定向。
| 属性 | 值 |
|---|---|
| 模型类型 | CrossTransformer3DModel |
| 参数量 | 5.65 B |
| 输入通道 | 33 (视频特征 + 轨迹) |
| 输出通道 | 16 |
| Transformer 层数 | 42 |
| Attention Heads | 48 |
| Hidden Size | 3072 |
| Patch Size | 2 |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| 操作系统 | CentOS 7.6+ / Ubuntu 18.04+ | 支持主流 Linux 发行版 |
| CANN | 5.0.RC2+ | 华为昇腾计算架构 |
| Python | 3.10+ | 推荐 3.10+ |
| PyTorch | 2.0.0+ | 推荐 2.12 |
| torch_npu | 与 PyTorch 版本匹配 | 昇腾 PyTorch 扩展 |
| diffusers | >=0.32.0 | 扩散模型加载 |
conda activate pt2100
pip install diffusers -i https://repo.huaweicloud.com/repository/pypi/simplecd /workspace/agent4/TrajectoryCrafter-ascend
ls -la /workspace/agent3/TrajectoryCrafter/TrajectoryCrafter/npu-smi info
python -c "import torch; import torch_npu; print('NPU 可用:', torch.npu.is_available())"python inference.py --device npu:0conda activate pt2100
cd /workspace/agent4/TrajectoryCrafter-ascend
python inference.py --device npu:0实际输出:
============================================================
TrajectoryCrafter 昇腾 NPU 推理
============================================================
[Device] npu:0
[Model Path] /workspace/agent3/TrajectoryCrafter/TrajectoryCrafter
[Config]
_class_name: CrossTransformer3DModel
in_channels: 33
out_channels: 16
num_layers: 42
num_attention_heads: 48
sample_frames: 49
sample_height: 60
sample_width: 90
[Memory Before Model Load] Allocated: 0.00 GB, Reserved: 0.00 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| npu-smi 25.5.2 Version: 25.5.2 |
+---------------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.7 41 0 / 0 |
+===========================+===============+====================================================+
[Loading] TrajectoryCrafter model weights...
[Loading] TrajectoryCrafter model from ...TrajectoryCrafter
Total keys: 1047
Total parameters: 5.65 B
[Model Created] Allocated: 10.99 GB, Reserved: 11.71 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.7 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 15480/ 65536 |
+===========================+===============+====================================================+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| 0 0 | 1713014 | python | 12110 |
+===========================+===============+====================================================+
[Running] TrajectoryCrafter inference...
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 125.6 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 16449/ 65536 |
+===========================+===============+====================================================+
[Results]
Output shape: torch.Size([1, 2640, 128])
Output mean: -0.000346
Output std: 0.569481
[Memory After Inference] Allocated: 11.00 GB, Reserved: 12.65 GB
[Done]| 指标 | 值 |
|---|---|
| 模型参数量 | 5.65 B |
| 推理显存峰值 | ~12-16 GB |
| 输出 Shape | (1, 2640, 128) |