This is a repository for classifying parking lot images as empty or occupied. The associated technical report can be found in report.pdf (in French). Implementation of the networks from Deep learning for decentralized parking lot occupancy detection is carried out with some extended testing.
The repository contains several directories:
code/: this is the main code for running the training and get the results of the neural networkslatex/: directory containing the LaTeX source filespklotclass/: Python library written and used incode/written using PyTorch for the deep learning part.
The library is written in an object-oriented fashion. The content of each file is described below:
dataloader.py: contains theParkingLotDatasetclass which overloads the baseDatasetclass from PyTorch and reads parking lot datasetseval.py: performs evaluation of a neural network on a test datasetlog.py: contains functions for creating logging objectsmodel.py: contains the neural network architectures. A base class is first written which inherits from thenn.Moduleclass of PyTorch. This base class holds a method for computing the number of training parameters and the other three classes inherit from it.multiple_train.py: script to launch multiple trainings sequentiallymultiple_train.py: script to launch multiple evaluations sequentiallypproc.py: routines for post-processing themetrics.h5generated during trainingpredict.py: script for inference of a given set of imagestrain.py: performs the actual training of neural networkstrainer.py: contains theTrainerclass instantiated intrain.pyutil.py: contains common functions used across the library
The library is called via executables created in setup.py:
entry_points={
'console_scripts': [
'pklot_train=pklotclass.train:main',
'pklot_trains=pklotclass.multiple_train:main',
'pklot_plot=pklotclass.pproc:main',
'pklot_predict=pklotclass.predict:main'
],
},Each of these executables are run via a configuration file written in YAML format (for example code/malexnet_cnr.yml for the train_network executable). These configuration files are converted into Python dictionnaries which are parsed throughout the code.
To install the library you need Python 3.8 or above version. Run the following command at the root of the repository (preferably in a virtual environment):
pip install -e .If there are some missing packages, an image of a working python 3.8 version on Mac can be found in requirements.txt and so the following command should be run:
pip install -r requirements.txtTo run PyTorch on GPUs special versions of PyTorch should be installed with CUDA. Please refer to this link for a proper installation. For PyTorch 1.10.1 with CUDA 11.1 on Linux for example run the following command on terminal:
pip install torch==1.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.htmlTo reproduce the results shown in the technical report, first download the datasets in the root of the repository using the following shell script (you need wget):
./get_datasets.shThen for training and evaluation go to the code/ repository and run the two shell scripts:
cd code/
./train.sh
./eval.shYou can skip training and just evaluate the networks by downloading the pre-trained networks at this link and then unzip inside the code/ repository (note that you need a GPU with CUDA to relaunch the models in this case):
unzip train.zip
./eval.shNote that the models have been run on an NVIDIA A30 GPU.