Package: dunedn
DUNEdnIf you use this software please cite thispaper@article{dunedn,author={Rossi, Marcoand Vallecorsa, Sofia},title={Deep Learning Strategies for ProtoDUNE Raw Data Denoising},journal={Computing and Software for Big Science},year={2022},month={Jan},day={07},volume={6},number={1},numpages={9},issn={2510-2044},doi={10.1007/s41781-021-00077-9},url={https://doi.org/10.1007/s41781-021-00077-9}}DUNEdn is a denoising algorithm for ProtoDUNE-SP raw data with Neural Networks.InstallationThe package can be installed with Python's pip package manager:gitclonehttps://github.com/marcorossi5/DUNEdn.gitcdDUNEdn
pipinstall.This process will copy the DUNEdn program to your environment python path.NoteThesaved_modelsdirectory contains the checkpoints to reproduce
the results presented inarXiv:2103.01596.Since some of the saved models files are quite large (~100 MB), they are uploaded
viagit-lfs. when cloning the repo, it is possible
to download pointers to those large files rather than the whole binaries. This can
be achieved adding the flag--config lfs.fetchexclude="*.pth*"to thegit clonecommand above.RequirementsDUNEdn requires the following packages:python3numpypytorchtorchvisionmatplotlibhyperoptRunning the codeIn order to launch the codedunedn<subcommand>[options]Valid subcommands are:preprocess|train|inference.Usedunedn <subcommand> --helpto print the correspondent help message.For example, the help message fortrainsubcommand is:$dunedntrain--help
usage:dunedntrain[-h][--outputOUTPUT][--force]configcard

Trainmodelloadingsettingsfromconfigcard.

positionalarguments:configcardyamlconfigcardpath

optionalarguments:-h,--helpshowthishelpmessageandexit--outputOUTPUToutputfolder--forceoverwriteexistingfilesifpresentConfiguration cardsModels' parameter settings are stored in configcards. Theconfigcardsfolder contains some examples. These can be extended providing the path to user
defined cards directly to the command line interface.Setting theDUNEDN_SEARCH_PATHenvironment variable it is possible to let DUNEdn
looking for configcards into different directories automatically. More on the
search behavior can be found at theget_configcard_pathfunction's docstring
in theutils/ultis.pyfile.Preprocess a datasetAt first, a dataset directory should have the following structure:dataset directory tree structure:
dataset_dir
  |-- train
  |    |--- evts
  |-- val
  |    |--- evts
  |-- test
  |    |--- evtswhere eachevtsfolder contains a collection of ProtoDUNE events stored as raw
digits (numpy array format).It is possible to generate the correspondent dataset to train an USCG or a GCNN
network with the command:dunednpreprocess<configcard.yaml>--dir_name<datasetdirectory>This will modify the dataset directory tree in the following way:dataset directory tree structure:
dataset_dir
  |-- train
  |    |--- evts
  |    |-- planes (preprocess product)
  |    |-- crops (preprocess product)
  |-- val
  |    |--- evts
  |    |--- planes (preprocess product)
  |-- test
  |    |--- evts
  |    |--- planes (preprocess product)Training a modelAfter specifying parameters inside a configuration card, leverage DUNEdn to train
the correspondent model with:dunedntrain<configcard.yaml>The output directory is set by default tooutput. Optionally, theDUNEDN_OUTPUT_PATHenvironment variable could be set to override this choice.Inferencedunedninference-i<input.npy>-o<output.npy>-m<modeltype>[--model_path<checkpoint.pth>]DUNEdn inference takes theinput.npyarray and forwards it to the desired modelmodeltype. The output array is saved tooutput.npy.If a checkpoint directory path is given with the optional--model_pathflag, a
saved model checkpoint could be loaded for inference.The checkpoint directory should have the following structure:model_path
    |-- collection
    |       |-- <ckpt directory name>_dn_collection.pth
    |-- induction
    |       |-- <ckpt directory name>_dn_induction.pthOn the other hand, if--model_pathis not specified, an un-trained network is issued.BenchmarkThe paper results can be reproduced through thecompute_denoising_performance.pybenchmark.Please, see the script's docstring for further information.