目录

modelnet40-pct-classification

Point cloud classification project based on Jittor and a simplified PCT (Point Cloud Transformer) model for the ModelNet40 dataset.

Overview

This project trains a point cloud classifier on ModelNet40 and generates test predictions in result.json.

The current implementation includes:

  • point sampling from .npy point cloud files
  • simple training augmentation
  • PCT-style self-attention blocks
  • stratified train/validation split
  • AdamW optimizer
  • label smoothing
  • best checkpoint selection by validation accuracy
  • test-time voting

Project Structure

PA3/
├─ data/
│  ├─ categories.txt
│  ├─ train_points.npy
│  ├─ train_labels.npy
│  └─ test_points.npy
├─ pct.py
├─ PA3_README.pdf
└─ README.md

Environment

This project is currently intended to run in WSL Ubuntu with a CPU-only Jittor environment.

Reason:

  • native Windows Jittor import/compile was not stable on this machine
  • the current script forces Jittor to stay on the CPU path for reliability

Main Dependencies

  • Python 3.10
  • jittor
  • numpy

Data Format

The code expects the following files under ./data:

  • train_points.npy
  • train_labels.npy
  • test_points.npy
  • categories.txt

Expected shapes:

  • train_points.npy: (N, 2048, 3)
  • train_labels.npy: (N,)
  • test_points.npy: (M, 2048, 3)

How to Run

Run in WSL

Recommended command:

wsl -d Ubuntu bash /mnt/c/Users/ChenChong/Desktop/PA3/wsl_run_pct_cpu.sh

Run with Custom Arguments

Example:

wsl -d Ubuntu bash /mnt/c/Users/ChenChong/Desktop/PA3/wsl_run_pct_cpu.sh --epochs 10 --batch_size 8 --n_points 512 --lr 0.001 --vote_num 3

Direct Python Run

If your current environment already has a working CPU-only Jittor installation:

python pct.py

Main Arguments

The most important command-line arguments are:

  • --data_dir: dataset directory, default ./data
  • --n_points: number of sampled points per shape, default 1024
  • --batch_size: batch size, default 32
  • --epochs: number of training epochs, default 200
  • --lr: learning rate, default 0.001
  • --seed: random seed, default 42
  • --val_ratio: validation split ratio, default 0.1
  • --weight_decay: AdamW weight decay, default 0.05
  • --label_smoothing: label smoothing factor, default 0.2
  • --vote_num: number of test-time votes, default 3

Outputs

After training, the script produces:

  • pct_model_best.pkl: best model selected by validation accuracy
  • pct_model.pkl: final loaded model used for prediction
  • result.json: test set predictions

Training Logs

Each epoch prints:

  • training loss
  • training accuracy
  • validation loss
  • validation accuracy
  • learning rate
  • epoch time

Example:

Epoch [1/20]  Loss: 2.1000  Train Acc: 42.35%  Val Loss: 1.9500  Val Acc: 48.20%  LR: 0.000994  Time: 620.4s

The most important metric during training is Val Acc.

Notes

  • The script explicitly sets os.environ["nvcc_path"] = "" before importing Jittor.
  • The script also sets jt.flags.use_cuda = 0.
  • This means the current version is designed to run on CPU for stability.
  • Full training on CPU can be slow, especially with large n_points and many epochs.

Suggested Experiments

If you want faster iteration, try:

wsl -d Ubuntu bash /mnt/c/Users/ChenChong/Desktop/PA3/wsl_run_pct_cpu.sh --epochs 10 --batch_size 8 --n_points 512

If you want to push accuracy further, try:

  • increasing epochs
  • keeping n_points reasonably high
  • watching Val Acc instead of only Train Acc
  • comparing different vote_num values

Repository Tip

Recommended project URL identifier:

modelnet40-pct-classification
关于

A Jittor implementation of Point Cloud Transformer(PCT) for ModelNet40 classification

245.0 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号