Deep Learning based 3D Particle Identification
Code, dataset, and trained models for the paper "PIDNet: Deep Learning based
If you find this code useful in you work, please cite:
@article{bay2020pidnet,
title={PIDNet: Deep Learning based $\bold{e^-/\pi^0}$ separation in the Single Phase Liquid Argon TPC},
author={},
journal={arXiv preprint arXiv:},
year={2020}
}
- Clone this repo:
cd ~
git clone https://https://github.com/yasinalm/PIDNet
cd PIDNet-
Linux (Tested on Ubuntu 16.04)
-
NVIDIA GPU (Tested on Nvidia GTX 1080 Ti)
-
CUDA, CuDNN
-
Python 3
-
tensorflow-gpu>=2.0.0
-
Tensorboard>=2.0.0
-
scipy
-
Install Tensorflow 2.0.0+ and other dependencies.
- For pip users, please type the command
pip install -r requirements.txt. - For Conda users, you can use an installation script
./scripts/conda_deps.sh. Alternatively, you can create a new Conda environment usingconda env create -f environment.yml.
- For pip users, please type the command
- Our dataset consists of particles generated in Monte Carlo simulations.
- Place your dataset in
./datasetfolder and use the codes in./prepapre_datafolder to pre-process.
Data needs to be arranged in the following format:
.
├── dataset5d
│ └── 1500sp_evts
│ ├── electron-38323
│ ├── muon-62190
│ ├── pionminus-39144
│ ├── pionzero-35674
│ ├── proton-36793
│ ├── test_files35k_5p.csv
│ └── train_files35k_5p.csv
└── PIDNet
├── figs
│ └── confusion_matrix_pointnet.png
├── logs
│ └── checkpoints
│ ├── checkpoint
│ ├── iter-102828.data-00000-of-00002
│ ├── iter-102828.data-00001-of-00002
│ └── iter-102828.index
├── src
│ ├── dataset_utils.py
│ ├── eval_test_set.py
│ ├── eval_test_set_tsne.ipynb
│ ├── inference.py
│ ├── match_pred_momentum.ipynb
│ ├── model.py
│ ├── plot_pred_momentum.ipynb
│ ├── roc_curve.ipynb
│ ├── train.py
└── utils
├── helpers.py
└── visualize.py
- Prepapare the data using the command: 'prepare_data/python prepare_fixedsp_data.py'
- Create a list of train and test files with the Jupyter notebook file prepare_data/generate_train_test_files.ipynb
- Just sequentially run the code blocks in the notebook.
- Run the model in the pid_net folder: 'python src/train.py'
To train a model:
python -u src/train.py |& tee logs/log_training_$(date '+%Y%m%d-%H%M%S').txtTo train with custom parameters:
python -u src/train.py --n_classes=5 --batch_size=64 --epochs=50 |& tee logs/log_training_$(date '+%Y%m%d-%H%M%S').txtTo resume training from a checkpoint (if directory, uses the latest checkpoint in the directory):
python -u src/train.py --init_weight=${ckpt_dir} |& tee logs/log_training_$(date '+%Y%m%d-%H%M%S').txtIf you have multiple GPUs on your machine, you can also run the multi-GPU version training:
CUDA_VISIBLE_DEVICES=0,1 python -u src/train.py |& tee logs/log_training_$(date '+%Y%m%d-%H%M%S').txt- To see more intermediate results, check out
./logs/checkpoints/. - To view training results and loss plots, run
tensorboard --logdir logs/and click the URL http://localhost:6006.
- The pretrained model is saved at
./logs/checkpoints/.
To test the model:
python -u src/eval_test_set.py --init_weight=${ckpt_dir} |& tee logs/log_test.txt- The statistics will be prompted to screen and confusion matrix result will be saved to a png file here:
./figs/confusion_matrix.png.
This project is licensed under the MIT License - see the LICENSE file for details
If you find our work useful in your research please consider citing our paper:
@article{bay2020pidnet,
title={PIDNet: Deep Learning based $\bold{e^-/\pi^0}$ separation in the Single Phase Liquid Argon TPC},
author={},
journal={arXiv preprint arXiv:},
year={2020}
}




