Giter Club home page Giter Club logo

image-nilm's Introduction

Exploring Time Series Imaging for Load Disaggregation

The repository at hand contains the python code relative to our BuildSys20' paper

Hafsa Bousbiat, Christoph Klemenjak, and Wilfried Elmenreich. 2020. Exploring Time Series Imaging for Load Disaggregation. In The 7th ACM International Conference on Systems for Energy-Efficient Buildings, Cities, and Transportation (BuildSys ’20), November 18–20, 2020, Virtual Event, Japan.

Proposed Approach

Many wide-spread load disaggregation techniques perform a sequence-to-sequence mapping between an input sequence (aggregate power readings) and an output sequence that consists of power readings associated with a particular electrical appliance. We propose to augment this pipeline with a 1D-2D transform: a time series imaging block, as illustrated by the figure below.

The proposed approach, which we refer to as Image-to-Sequence (I2S), was designed to be fully compatible to NILMTK , a NILM toolkit for reproducible experiments. I2S incorporates implementations of GAF, MTF, and RP provided by the PyTS package. We provide below three sample images created from 150 minutes of smart meter data to get a sense of how images obtained from GASF, MTF and RP differ. All three transforms generate symmetric images where the value of a pixel gives insights on the similarity between two instants.

Reference

 @inproceedings{bousbiat2020imaging,
  title={Exploring Time Series Imaging for Load Disaggregation},
  author={Bousbiat, Hafsa and Klemenjak, Christoph  and Elmenreich, Wilfried},
  booktitle={Proceedings of the 7th ACM International Conference on Systems for Energy-Efficient Buildings, Cities, and Transportation},
  year={2020}
}

image-nilm's People

Contributors

bhafsa avatar

Stargazers

Li KeChun avatar Alex avatar  avatar  avatar Giorgos Angelis avatar  avatar  avatar  avatar p0p avatar  avatar Christoph Klemenjak avatar

Watchers

James Cloos avatar  avatar

image-nilm's Issues

I can't use this code,could you help me?

hello everyone,

Thank you for open code!

I get some errors when I use ukdale2.h5 to test code. Could you help me?

error 1:

File "D:\code\image-nilm-main\image-nilm-main\src\disaggregate\batchgenerator.py", line 22, in __init__
    super.__init__(BatchGenerator,)
TypeError: descriptor '__init__' requires a 'super' object but received a 'type'

I choose comment this line in the code!

class BatchGenerator(tf.keras.utils.Sequence) :
    def __init__(self, x_sequence,y_sequence, batch_size,img_method = 'gasf',img_size = 28) :
        # super.__init__(BatchGenerator,)
        self.x_sequence = x_sequence
        self.y_sequence = y_sequence
        self.batch_size = batch_size
        self.img_method = img_method
        self.img_size = img_size

error 2:

File "D:\code\image-nilm-main\image-nilm-main\src\disaggregate\Im2Seq.py", line 130, in partial_fit
    loss_history = LossHistory()
NameError: name 'LossHistory' is not defined

I think maybe you delete the function LossHistory and step_decay, so I comment these line in the code and change the callback_llist.

validation_batch_generator = BatchGenerator(v_x, v_y, self.batch_size, self.img_method,
                                            self.img_size)

# loss_history = LossHistory()
# lrate = LearningRateScheduler(step_decay)
# callbacks_list = [loss_history, lrate, checkpoint]
callbacks_list = [checkpoint]

with tf.device('/device:GPU:0'):
    print('training with GPU')
    model.fit_generator(generator=batch_generator,
                        steps_per_epoch=int(len(train_y) // self.batch_size),
                        epochs=self.n_epochs,
                        verbose=1,
                        shuffle=True,
                        callbacks=checkpoint,
                        validation_data=validation_batch_generator,
                        validation_steps=int(len(v_y) // self.batch_size))
model.load_weights(filepath)

error 3:

File "E:\Software\Anaconda3\envs\nilmtk\lib\site-packages\tensorflow\python\keras\callbacks.py", line 98, in configure_callbacks
    callbacks = [BaseLogger()] + (callbacks or []) + [model.history]

TypeError: can only concatenate list (not "ModelCheckpoint") to list

I think maybe you change the code, so I change the code!

Original Code:

with tf.device('/device:GPU:0'):
    print('training with GPU')
    model.fit_generator(generator=batch_generator,
                        steps_per_epoch=int(len(train_y) // self.batch_size),
                        epochs=self.n_epochs,
                        verbose=1,
                        shuffle=True,
                        callbacks=checkpoint,
                        validation_data=validation_batch_generator,
                        validation_steps=int(len(v_y) // self.batch_size))
model.load_weights(filepath)

Change the code:

with tf.device('/device:GPU:0'):
    print('training with GPU')
    model.fit_generator(generator=batch_generator,
                        steps_per_epoch=int(len(train_y) // self.batch_size),
                        epochs=self.n_epochs,
                        verbose=1,
                        shuffle=True,
                        callbacks=[checkpoint],  ### add [] in this line #####
                        validation_data=validation_batch_generator,
                        validation_steps=int(len(v_y) // self.batch_size))
model.load_weights(filepath)

error 4:

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument: Incompatible shapes: [64,120,1] vs. [64,120]
	 [[{{node loss_3/conv1d_3_loss/SquaredDifference}}]]
	 [[loss_3/mul/_131]]
  (1) Invalid argument: Incompatible shapes: [64,120,1] vs. [64,120]
	 [[{{node loss_3/conv1d_3_loss/SquaredDifference}}]]
0 successful operations.
0 derived errors ignored.

I don't konw how can I solve this problem, could you help me? Could you give me a complete code?

Thank you very much!

Best wishes!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.