RepositoryofMC4AD
July 31, 2025 · View on GitHub
Hanzhe Liang, Aoran Wang, Jie Zhou, Xin Jin, Can Gao*, Jinbao Wang*
* Co-Corresponding. For the paper, you can check the following link.

Environments
You need to create our environment. Our code runs on the device CUDA 11.1. If you do not have any environments already created, please run:
conda create -n py3-TA python=3.8
conda activate py3-TA
conda install -c pytorch -c nvidia -c conda-forge pytorch=1.9.0 cudatoolkit=11.1 torchvision
conda install openblas-devel -c anaconda
Or you can run the following to create the environment:
conda env create -f environment.yml
Then, you need to download the MinkowskiEngine. Please run:
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps --install-option="--blas_include_dirs=${CONDA_PREFIX}/include" --install-option="--blas=openblas"
cd MinkowskiEngine
python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas
Or you can download the environment tar.gz file at this link.
Datasets
Please download the datasets we used. You can download Real3D-AD dataset and Anomaly-ShapeNet&Anomaly-ShapeNet-New. We provide dataload for Real3D-AD, Anomaly-ShapeNet, and Anomaly-ShapeNet-New. if you want to implement MvTec3D-AD, you need to go to the official implementation of M3DM, which is attributed to the fact that MvTec3D-AD uses depth maps, and you need to use the preprocessing tools and conversion tools it provide to change it to a point cloud form. Put the data and checkpoints in the corresponding folders:
code
├── datasets
│ ├── AnomalyShapeNet
│ │ ├── dataset
│ │ │ ├── obj
│ │ │ ├── pcd
├── log
│ ├── ashtray0
│ │ ├── ashtray0.pth
│ ├── ...
Training & Evaluation
Eval
First, you need to download the checkpoints and input into the file log.
You can train and change the train setting depending on config/train_config:
python train.py --category bowl4 --logpath ./log/cap0/
# We take class cap0 for example; you can also replace 'cap0' with the class you want.
The partly class needs to train about 2000 epochs.
Train
You can eval:
# Y.ou can evaluate and change the evaluation setting depending on `config/eval_config`.
python eval.py
To Do List
[O] Eval Code 2025/4/30 You can start testing now.
[O] Checkpoints 2025/5/25 You can now load checkpoints to reproduce all results on Anomaly-ShapeNet.
[ ] Train Code
[ ] Datasets
Intraclass-Variance Benchmark
This is a dataset with intraclass variance called Anomaly-ShapeNet-Intraclass-Variance. This data contains 8 classes in both PCD and OBJ formats. The training dataset contains two normal samples each of two subcategories under the same broad category (four in total). The test dataset contains normal samples and multiple anomalies in both subcategories. Here are the Statistical Data. The industrial test dataset used will be released upon acceptance, taking into account copyright reasons.
Statistics from Anomaly-ShapeNet and AnomalyShape-Net-New , datasets organized by the authors.
| class | subcategories | template | positive | hole | bulge | concavity | crak | broken | scratch | bending | total |
|---|---|---|---|---|---|---|---|---|---|---|---|
| bottle | 2 | 4 | 30 | 2 | 14 | 14 | 1 | 2 | \ | \ | 67 |
| bowl | 2 | 4 | 30 | \ | 14 | 14 | \ | \ | 8 | \ | 70 |
| bucket | 2 | 4 | 30 | 4 | 14 | 14 | 4 | 4 | 2 | \ | 76 |
| cap | 2 | 4 | 30 | 4 | 14 | 14 | \ | 4 | \ | 1 | 71 |
| cup | 2 | 4 | 30 | \ | 14 | 14 | \ | \ | \ | \ | 62 |
| helmet | 2 | 4 | 30 | 2 | 14 | 14 | 2 | 2 | 1 | 2 | 71 |
| microphone | 2 | 4 | 30 | \ | 14 | 14 | \ | \ | \ | \ | 62 |
| tap | 2 | 4 | 30 | 4 | 14 | 14 | 2 | 4 | 2 | \ | 74 |
Statistical Data of the Data Made by the Author.
| class | subcategories | template | positive | missing | bulge | crack | twist | total |
|---|---|---|---|---|---|---|---|---|
| cone | 4 | 4 | 25 | 11 | 7 | 4 | 8 | 59 |
| bowl | 4 | 4 | 25 | 10 | 7 | 3 | 7 | 56 |
| door | 4 | 4 | 21 | 2 | 4 | 3 | 7 | 41 |
| keyboard | 4 | 4 | 24 | 11 | 8 | 4 | 6 | 57 |
| night_stand | 4 | 4 | 31 | 5 | 6 | 3 | 6 | 55 |
| radio | 4 | 4 | 25 | 8 | 7 | 4 | 7 | 55 |
| vase | 4 | 4 | 32 | 12 | 8 | 4 | 8 | 68 |
| xbox | 4 | 4 | 29 | 11 | 8 | 3 | 8 | 63 |
Acknowledge
This code partly from PO3AD Anomaly-ShapeNet and ISMP. If possible, please cite them.
@misc{ye2024po3adpredictingpointoffsets,
title={PO3AD: Predicting Point Offsets toward Better 3D Point Cloud Anomaly Detection},
author={Jianan Ye and Weiguang Zhao and Xi Yang and Guangliang Cheng and Kaizhu Huang},
year={2024},
eprint={2412.12617},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2412.12617},
}
@InProceedings{Li_2024_CVPR,
author = {Li, Wenqiao and Xu, Xiaohao and Gu, Yao and Zheng, Bozhong and Gao, Shenghua and Wu, Yingna},
title = {Towards Scalable 3D Anomaly Detection and Localization: A Benchmark via 3D Anomaly Synthesis and A Self-Supervised Learning Network},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2024},
pages = {22207-22216}
}
@misc{liang2025lookinsidemoreinternal,
title={Look Inside for More: Internal Spatial Modality Perception for 3D Anomaly Detection},
author={Hanzhe Liang and Guoyang Xie and Chengbin Hou and Bingshu Wang and Can Gao and Jinbao Wang},
year={2025},
eprint={2412.13461},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2412.13461},
}