Torch-NILM: An Effective Deep Learning Toolkit for Non-Intrusive Load Monitoring in Pytorch

Nikolaos Virtsionis Gkalinikis, Christoforos Nalmpantis, Dimitris VrakasEnergies 2022 · DOI

TL;DR

This paper introduces Torch-NILM, a new open-source Python toolkit built on PyTorch, designed to streamline and standardize non-intrusive load monitoring (NILM) research. By providing a unified framework with pre-built models, data handling, and benchmarking tools, Torch-NILM aims to address the reproducibility and comparability issues plaguing the field, making it easier for researchers to develop and evaluate deep learning models for energy disaggregation.

What Problem Does This Paper Address?

Non-intrusive load monitoring (NILM) is a crucial area in energy informatics, aiming to disaggregate total household energy consumption into individual appliance usage using only a single main meter. While deep learning has shown great promise in this "blind source separation" task, the NILM research community faces significant challenges. A major hurdle is the lack of standardized tools and frameworks, leading to inconsistent experimental setups, difficulty in reproducing results, and a fragmented landscape for comparing different models. Researchers often have to build their own data pipelines, training loops, and evaluation metrics, which is time-consuming and hinders progress. This paper addresses this gap by providing a comprehensive, user-friendly toolkit that standardizes the NILM research workflow.

Methods

Torch-NILM offers a modular architecture with several key components:

  • Datasources Module: Handles loading and preprocessing data from various NILM datasets. It leverages the existing NILMTK library for data parsing and provides custom Dataset classes for different experiment categories (single vs. multi-building).
  • Lab Module: Contains the core training and experimentation tools, including the NILMExperiments class, which orchestrates the entire experiment lifecycle.
  • Neural Networks Module: Implements six popular deep learning architectures for NILM, including Denoising Autoencoders (DAE), Sequence-to-Point (S2P), Window GRU (WGRU), Self-Attentive Energy Disaggregator (SAED), Variational Autoencoder (VAE-NILM), and Neural Fourier Energy Disaggregator (NFED).
  • Utils Module: Provides reporting functionalities, evaluation metrics (F1 score, MAE, RETE), and helper functions.
  • Benchmark Module: Encapsulates a standardized benchmarking framework with four categories of tests, designed to evaluate model performance under varying conditions.

The toolkit emphasizes ease of use through high-level APIs for running experiments, including benchmark, cross-validation, and hyperparameter tuning. It also automates report generation with comparative plots.

Datasets

Torch-NILM is designed to be compatible with datasets parsable by NILMTK. For this study, the authors utilized three popular datasets:

  • UK-DALE: Contains data from UK households.
  • REDD: Contains data from US households.
  • REFIT: Contains data from UK households.

These datasets were chosen for their popularity in NILM research, variety of appliances and households, data volume, and granularity. The paper also mentions a benchmark framework developed by Symeonidis et al. [13] which Torch-NILM integrates, providing specific training and testing scenarios.

Key Insights and Ideas

  • Standardization is Key: The core idea is that a standardized toolkit is essential for reproducible and comparable NILM research. By abstracting away much of the boilerplate code, Torch-NILM allows researchers to focus on model development and evaluation.
  • PyTorch Ecosystem Leverage: The toolkit effectively harnesses the benefits of PyTorch and PyTorch Lightning, offering a user-friendly and efficient development experience.
  • Integrated Benchmarking: The inclusion of a robust benchmarking framework with predefined scenarios is a significant contribution, enabling direct comparison of different models and approaches.
  • Modularity for Flexibility: The decoupled components (data handling, training, inference) allow for easy modification and extension, catering to diverse research needs.
  • Bridging the Gap: Torch-NILM acts as a bridge between the established NILMTK library and the cutting-edge deep learning capabilities of PyTorch, making advanced NILM research more accessible.

Key Results

The paper demonstrates the effectiveness of Torch-NILM through a performance verification and a case study.

  • Performance Verification: A comparison with the NILMTK-Contrib API showed that Torch-NILM produced similar results for the S2P model across three appliances, with a maximum percentage difference of 1.66% and a maximum percentage error of 3.27%. This validates the toolkit's accuracy and consistency.
  • Case Study: A benchmark case study using the S2P, NFED, and DAE models on the microwave appliance showed that Torch-NILM can automatically generate comparative graphs and reports. In single-category experiments, S2P generally performed best, while NFED and S2P achieved similar MAE scores. In multi-category experiments, S2P again showed strong performance. The reporting module effectively visualized these results, highlighting the toolkit's ability to provide clear insights.

Limitations and Future Work

The authors acknowledge several areas for future development:

  • Graphical User Interface (GUI): Implementing a modern GUI would further simplify the experiment execution process.
  • Advanced Data Processing: Introducing more sophisticated data processing techniques and visualization options would enhance the toolkit's capabilities.
  • Multi-label Classification Support: Currently, Torch-NILM primarily supports regression approaches (one model per device). Extending it to support multi-label classification techniques would broaden its applicability.

Summary updated

Abstract

Non-intrusive load monitoring is a blind source separation task that has been attracting significant interest from researchers working in the field of energy informatics. However, despite the considerable progress, there are a very limited number of tools and libraries dedicated to the problem of energy disaggregation. Herein, we report the development of a novel open-source framework named Torch-NILM in order to help researchers and engineers take advantage of the benefits of Pytorch. The aim of this research is to tackle the comparability and reproducibility issues often reported in NILM research by standardising the experimental setup, while providing solid baseline models by writing only a few lines of code. Torch-NILM offers a suite of tools particularly useful for training deep neural networks in the task of energy disaggregation. The basic features include: (i) easy-to-use APIs for running new experiments, (ii) a benchmark framework for evaluation, (iii) the implementation of popular architectures, (iv) custom data loaders for efficient training and (v) automated generation of reports.
BibTeX
@inproceedings{gkalinikis2022torch,
  author = {Nikolaos Virtsionis Gkalinikis and Christoforos Nalmpantis and Dimitris Vrakas},
  title = {{Torch-NILM: An Effective Deep Learning Toolkit for Non-Intrusive Load Monitoring in Pytorch}},
  booktitle = {Energies},
  year = {2022},
  doi = {10.3390/en15072647},
}
Figure