After we are done with Data Preprocessing we will create the trainset and the testset for the model.For this we can run the following commands:
After creating the dataset next step is to pass our training data into our Deep Learning model to learn to predict the trends in the Energy Consumption.The model architecture used was:
Layer (type) Output Shape Param #
lstm (LSTM) (None, 100) 43200
dropout (Dropout) (None, 100) 0
dense (Dense) (None, 1) 101
Total params: 43,301
Trainable params: 43,301
Non-trainable params: 0
The loss function used was “mean_squared_error” and optimizer used was “Adam”.For training the model we used Keras API with tensorflow at backend. .Here are the training plots for the model:
And here is the final prediction made on the test set and we have plotted it on a graph.
DeepC Compiler and inference framework is designed to enable and perform deep learning neural networks by focussing on features of small form-factor devices like micro-controllers, eFPGAs, cpus and other embedded devices like raspberry-pi, odroid, arduino, SparkFun Edge, risc-V, mobile phones, x86 and arm laptops among others.
DeepC also offers ahead of time compiler producing optimized executable based on LLVM compiler tool chain specialized for deep neural networks with ONNX as front end.
After training the model, it was saved in an H5 format using Keras as it easily stores the weights and model configuration in a single file.
After saving the file in H5 format we can easily compile our model using DeepC compiler which comes as a part of cAInvas platform so that it converts our saved model to a format which can be easily deployed to edge devices.And all this can be done very easily using a simple command.
And that’s it, our Energy Consumption Detection model is set to be deployed on edge devices.
Link for the cAInvas Notebook : https://cainvas.ai-tech.systems/use-cases/energy-consumption-prediction-app/
Credit : Ashish Arya