{ "info": { "author": "Frederik Faye", "author_email": "frederikfaye@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# DeepCalo\n### Python 3 package for doing deep supervised learning on ATLAS data, using Keras\nAuthor: Frederik Faye, The Niels Bohr Institute, 2019\n\n## What is DeepCalo?\nThis package allows you to build, train and tune convolutional neural network (CNN) models using Keras with any backend.\n\nYou can also integrate models for processing non-image data, such as scalars and sequences.\nThe models that can be built have been designed specifically with the ATLAS detector in mind, but you can also just use the framework and all its nice features for any Keras-based project.\n\n## Why should you use it?\n* All hyperparameters are set through a single Python dictionary, making it very easy to experiment with different models.\n* A lot of advanced features are supported (such as cyclic learning rate schedules, grouped convolutions, DropBlock regularization, squeeze and excite modules, non-standard optimizers such as Yogi and Padam, and much more), and it is easy to add new ones.\n* Extensive logging is automatically created for each run of a model, including hyperparameters, plots of model architectures, and weights of the model during training, making it easy to keep track of what you have tried, and what came of it.\n\n### Table of Content\n- [Installation](#installation)\n- [Dependencies](#dependencies)\n- [Usage](#usage)\n - [Quick start](#quickstart)\n - [Using ATLAS data](#atlasdata)\n- [Model architectures](#archs)\n - [CNN](#arch_cnn)\n - [Network in network](#arch_network_in_network)\n - [Top](#arch_top)\n - [Scalar net](#arch_scalar_net)\n - [FiLM generator](#arch_film_gen)\n - [Track net](#arch_track_net)\n - [Gate net](#arch_gate_net)\n - [Combined](#arch_combined)\n- [Documentation](#docs)\n - [`data`](#doc_data)\n - [`params`](#doc_params)\n - [Keys concerning submodels](#doc_submodels)\n - [`dirs`](#doc_dirs)\n- [Known issues](#knownissues)\n- [Todo](#todo)\n\n\n## Installation\n```bash\npip install deepcalo\n```\n\n\n## Dependencies\n```python\nnumpy, pandas, matplotlib, h5py, joblib, tqdm, keras, tensorflow, scikit-optimize, keras-contrib, keras-drop-block\n```\n\nIf you want to be able to plot the graph of your model, please install `pydot` and `graphviz` (if possible, use `conda install python-graphviz` for `graphviz`).\n\n\n## Usage\n\n\n### Quick start\nThe main functionality lies in the so-called model container, which can be imported as\n```python\nfrom deepcalo import ModelContainer\n```\nSee the [documentation](#docs) below for all the details. However, often an example is a better way of learning. Some examples are found in the *demos* folder.\n\nDownload and run the MNIST tutorial:\n```bash\npython mnist_tutorial.py --exp_dir ./my_mnist_experiment/ -v 1\n```\nThis will train a tiny CNN for a single epoch to discriminate between the digits of the MNIST dataset, which should reach $`>95\\%`$ test accuracy after its first epoch.\n\nOpen the script to see what is going on; the important part is the hyperparameter section. Try playing around with the parameters to see if you can find a network that does better! Also have a look at the contents of the *logs* folder in the experiment directory (`./my_mnist_experiment/`) to see some of the nice logging features this framework has to offer.\n\nThere are a lot more hyperparameters to play around with. See the [documentation](#doc_params) for what is possible.\n\n\n### Using ATLAS data\nIn the *demos* folder, you will also find the more realistic examples of `run_model.py` and `hp_search.py`. The former shows how to run a single model (much like the MNIST example), while the latter shows how to use this package for doing hyperparameter optimization (using the Bayesian optimization of [scikit-optimize](https://github.com/scikit-optimize/scikit-optimize)).\n\nBoth use actual ATLAS simulation data to do energy regression. The data used herein can be downloaded from the lxplus (CERNBox) directory */eos/user/l/lehrke/Data/Data* (which should be visible to all current CERN members).\n\nThe scripts uses the function `deepcalo.utils.load_atlas_data` function, which is tailored to these datasets. If need be, you can modify this function to work with your data, however note that this framework uses the `'channels_last'` format, which is the standard in Keras.\n\n\n## Model architectures\nThe following is a quick tour of the different out-of-the-box models available. Each model is made for a different kind of input, e.g., images, scalar variables, tracks, or the output from other models.\n\nAll models except the [top](#arch_top) are optional to use. However, models are tied to their input in such a way that if for instance a `tracks` dataset is present in the suppplied [data](#doc_data), the [track net](#arch_track_net) will be integrated into the [combined model](#arch_combined).\n\nYou can find information about how to set the hyperparameters of these models in the [documentation](#doc_params), where each model has its own section.\n\n\n### CNN\nBelow, an illustration of the default CNN architecture can be seen. It is comprised of blocks. For all but the first block, a block begins with downsampling and the number of feature maps being doubled.\n\nThe tuple underneath the input denotes the size of the input (here height, width, channels).\n\nNote that normalization, the activation function, downsampling and global average pooling can all be turned on or off.\n\nThe output of the CNN is passed on to either the [top](#arch_top), or to the [network in network](#arch_network_in_network).\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n