This is the official implementation of paper 'C3D-AD: Toward Continual 3D Anomaly Detection via Kernel Attention with Learnable Advisor'. You can read paper here at Research Gate or Github.
Haoquan Lu, Hanzhe Liang, Jie Zhang, Chenxi Hu, Jinbao Wang, Can Gao.
For code-related issues, please contact Hanzhe Liang (email: lianghanzhe2023@email.szu.edu.cn).
For paper-related questions, please contact Haoquan Lu (email: 2200271072@email.szu.edu.cn).
😊If this research helped you, please give it a ⭐.
- Conda virtual environment creation
conda create -n CL3AD python=3.8
conda activate CL3AD
pip install -r requirements.txt
pip install "git+https://github.com/erikwijmans/Pointnet2_PyTorch.git#egg=pointnet2_ops&subdirectory=pointnet2_ops_lib"
pip install --upgrade https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl
-
Download feature extractor pre-trained weights. Point-MAE pre-trained weights can be downloaded here. After downloading, place the
modelnet_8k.pthfile in the./pretrain_ckpdirectory -
Download checkpoints of model. (Optional) After downloading from here, place the
ckpt_best.pth.tarfile in theexperiments/[dataset]/[load_path from config.yaml]directory. For example,experiments/real3d/checkpoints_x
-
How to get the Real3D-AD dataset. Download the Real3D-AD dataset from here. After downloading, unzip it to the directory you specified.
-
Real3D Downsampling. To simplify the training, you first need to downsampling the training set of Real3D. You can use the following command:
python downsample_pcd.py --radl3d_path <Path/to/your/Real3D-AD-PCD>After the above operations are completed, thereal3D_downdirectory will be created in the same directory layer asReal3D-AD-PCD. -
cd the experiment directory by running
cd ./experiments/real3d/. -
Modify the config.yaml. Please set the
dataset.data_dirandnet.data_dirofconfig.yamlto load the absolute path of your Real3D-AD-PCD. -
Train or eval by running:
sh train.sh 1 #GPU_IDorsh eval.sh #1 #GPU_ID.Note: Multi-gpu training is not currently supported. During eval, please set the saver.load_path of config.yaml to load the checkpoints.
-
Different continual tasks Please match the
dataset.task_num,dataset.train / test.meta_file,cls_dataset.train / test.meta_file,saver.load_path,saver.save_dir,evaluator.save_dir.
- How to get the Anomaly-ShapeNet dataset. Download the Anomaly-ShapeNet dataset from here. After downloading, unzip it to the directory you specified. Take out Anomaly-ShapeNet-v2/dataset/pcd and organize it into the following format:
Anomaly-ShapeNet
├── ashtray0
├── train
├── *template.pcd
...
├── test
├── 1_bulge.pcd
├── 2_concavity.pcd
...
├── GT
├── 1_bulge.txt
├── 2_sink.txt
...
├── bag0
...
-
Anomaly-ShapeNet dataset setting. Please change the name of the
pcddirectory toAnomaly-ShapeNetand fill the absolute path of theAnomaly-ShapeNetintodataset.data_dirandnet.data_dirin./experiments/Anomaly-ShapeNet/config.yaml. -
cd the experiment directory by running
cd ./experiments/Anomaly-ShapeNet/. -
Train or eval by running:
sh train.sh 1 #GPU_IDorsh eval.sh 1 #GPU_ID.Note: During eval, please set config.saver.load_path to load the checkpoints.
-
Different continual tasks Please match the
dataset.task_num,dataset.train / test.meta_file,cls_dataset.train / test.meta_file,saver.load_path,saver.save_dir,evaluator.save_dir.
- How to get the MulSen_AD dataset. Download the MulSen_AD dataset from here. After downloading, unzip it to the directory you specified. Follow Hanzhe Liang to process the dataset into the following format:
MulSen_AD_process
├── cotton
├── train
├── *template.pcd
...
├── test
├── x_good.pcd
├── y_bad.pcd
...
├── GT
├── *.txt
├── *.txt
...
├── cube
...
-
MulSen_AD dataset setting. Please change the name of the
pcddirectory toMulSen_AD_processand fill the absolute path of theMulSen_AD_processintodataset.data_dirandnet.data_dirin./experiments/MulSen_AD_process/config.yaml. -
cd the experiment directory by running
cd ./experiments/MulSen_AD_process/. -
Train or eval by running:
sh train.sh 1 #GPU_IDorsh eval.sh 1 #GPU_ID.Note: During eval, please set config.saver.load_path to load the checkpoints.
-
Different continual tasks Please match the
dataset.task_num,dataset.train / test.meta_file,cls_dataset.train / test.meta_file,saver.load_path,saver.save_dir,evaluator.save_dir.
For the pre-existing methods, we modified the content on their official code implementations to accommodate continuous learning settings. You can find the exact implementation baseline/.
Our work is built on MC3D-AD, UniAD, and Reg3D-AD, thanks their extraordinary works!
MIT License
Copyright (c) 2025 Hanzhe Liang
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
