Why save the model?
In this tutorial we are going to see about the machine learning flow from development to release phase, what is the need of saving a model and basics of OpenCV, GAN.
We need to save the models whenever we run as pickle file. Machine learning workflow is these following steps –
- Understanding Problem statement
- Gathering the data
- Data cleaning or pre-processing
- Divide the data into Train, validation and Test.
- Build the model
- Validate the model & test the model on real data
- Ensure the Accuracy, True positive and false positive
- Deploy the model.
Become Master of Artificial Intelligence by going through this online Artificial Intelligence Course.
Eg. Image classifier
The data (training text, document, images etc.) goes to feature vectors and then processed to the machine learning algorithm. The labels are passed directly to the machine learning algorithm. The typical steps involves training the model, validating and finalizing the model, saving the model and load the saved model for next prediction. This is a recurring process. We can use either forward or backward propagation to train the model.
Why should we save the model?
The classification should be performed in real time and need to be deployed in the production server. The challenges we might face are –
- Productions and local environment might not be the same
- The run time delay might occur.
- Classification needs to be done on real time on production server.
Next time whenever the image comes, the machine has to identify the same in case it matches the previous model already run in the system. From building a model to release it we must might the flow.
Prepare yourself for the Top Artificial Intelligence Interview Questions And Answers Now!
How to save the model?
Pickle file : Pickling, also known as Serializing is a method of converting any python object into a stream of bytes by considering the hierarchy of the object we are trying to convert. The Unpickling, also known as Marshaling is the reverse process of pickling where we convert stream of bytes to original python object by considering the same hierarchy which we followed previously.
H5 file : It is a data file save in the hierarchical data format (HDF). It contains multidimensional array scientific data. They are most commonly used in Aerospace, Engineering, Finance, Physics etc.
Saving the model pros and cons :
|Consistent way to save time and reuse the model everywhere once trained and tested perfectly.||Might not work if Sklearn and python versions are different from saving to loading environments.|
|Predictions can Faster!||To do predictions model needs to run again.|
|Can attain CI/CD (DevOps) with ease.||CI/CD nightmare|
Open CV :
OpenCV(Open Source Computer Vision) is an image processing library created by intel and maintained by Willow Garage. OpenCV was released under BSD (Berkeley Source Distribution) license free for both academic and commercial. It includes hundreds of computer vision algorithms. Available for C, C++ & python. Newest update opencv 3.4 (Dec 2017). It is easy to use and install. These are described in more detail on AI and Deep Learning Community.
The command used to install is Pip install opencv-python
GANs or Generative Adversarial Network is the class of AI algorithm used in unsupervised machine learning. They are used for image enhancement using automated texture synthesis in combination perceptual loss. The components of GAN are –
The major applications of GAN is that from the down sampled images i.e. the one with less details, the generators tires to approximate them to more natural detailed version.
Learn more about Artificial Intelligence from this AI Training in New York to get ahead in your career!