Skip to main content

Getting started with Deep Learning Caffe Framework - Fastest way(Installation +Web Demo)

Here is the fastest way to get started with caffe deep learning framework with installation and basic we application demo for image classification :

Installation :

Here i am using caffe official ubuntu image and running it on docker . Follow the steps mentioned below :
1.) Install docker setup on your machine . Follow this link : https://docs.docker.com/engine/installation/#time-based-release-schedule.
2.) I have build caffe ubuntu image and push to docker hub . You can pull it in to your local.
  docker pull anishratnawat/caffe_deep_learning
3.)Run this command on terminal :
    docker run -ti -p 5000 anishratnawat/caffe_deep_learning bash   
 // it will download the image if its not downloaded before.
// When downloading finishes , terminal will enter in to image bash and your terminal will change to :
root@d3a683f24784:/workspace#

If you install any necessary packages inside that image then you need to commit it to make changes persist .
docker commit <ContainerId> <NewImageName>

3.) Your caffe installation path is : /opt/caffe
4.) By this time , You are ready to get started with Caffe framework .

_________________________________________________________________________________

Web Demo :

Here is python based application that have web interface which will take image as a input and classify the image .

1.) Go inside caffe installation path : /opt/caffe
2.) Download caffe Net model and ImageNet data Auxillary data using below commands:
  •  ./scripts/download_model_binary.py models/bvlc_reference_caffenet
  • ./data/ilsvrc12/get_ilsvrc_aux.sh
3.) After this finishes , try to run the python server using :
python examples/web_demo/app.py & (& is used to run it in background)
4.) This will start your python server .
5.) you can access the python page from your browser .
  Just hit : http://0.0.0.0:<PORT>
  PORT you will get from this command :
ratnawat-macOS:~ ratnawat$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                     NAMES

eccc952b32aa        caffev1             "bash"              14 hours ago        Up 38 seconds       0.0.0.0:32771->5000/tcp   epic_brown

Here our port is 32771 . This may get change after each run .

So just hit : http://0.0.0.0:32771 . It will open page where you will upload image and Deep learning model will classify it .

Web App will look like this :



In case if you have any question or doubt , please free to comment below .




Comments

Popular posts from this blog

MonoLithic Vs Microservice Architecture | which Architecture should i choose ?

From last few years ,microservices are an accelerating trend . Indeed, microservices approach offers tangible benefits including an increase in scalability, flexibility, agility, and other significant advantages. Netflix, Google, Amazon, and other tech leaders have successfully switched from monolithic architecture to microservices. Meanwhile, many companies consider following this example as the most efficient way for business growth. On the contrary, the monolithic approach is a default model for creating a software application. Still, its trend is going down because building a monolithic application poses a number of challenges associated with handling a huge code base, adopting a new technology, scaling, deployment, implementing new changes and others. So is the monolithic approach outdated and should be left in the past? And is it worth shifting the whole application from a monolith to microservices ? Will developing a microservices application help you reach you...

C Program to sort an array using insertion sort

I have seen couple of students who use swap in insertion sort to sort an array.Insertion sort is an example of exchange sort ,we don't swap two elements to sort an array ,instead of this we shift elements if ith element is greater than i+1th element to sort an array.It works on simple concept:- Store the ith element in temporary variable and shift element until you find the element smaller than this element towards 0 index position.Here is the C Program to find insertion sort:- _________________________________________________________________________________ #include <stdio.h> #include <string.h> main() {     int arrSize,i;    printf("Enter Size of array:");    scanf("%d",&arrSize);    int array[arrSize];    for(i=0;i<arrSize;i++){        scanf("%d",&array[i]);    }    int temp,j;    for(i=1;i<arrSize;i++){        temp...

Perfect Hashing and its implementation in C

Perfect hashing simply means hashing with no collision.But there is nothing like perfect hashing(no collision).These are just a work around to achieve perfect hashing.Using this we can able to search the large set of records in a constant time i.e O(1) time complexity.To achieve searching in strict O(1) time ,one needs to implement hash table and then search the given record in to hash table using hash function.         Here in perfect hashing ,one need to implement two level hash table , first level hash table consist a set of pointers that points to the second level hash table,we must select hash function that first maps the key in to first level hash table,so it simply means there must be collision in first level hash table ,thats  why i am saying its just a work around to achieve prefect  hashing.We must wisely choose hash function:                  h(x)=((a*x+b)mod p)mod m x is the key to be map, Here ...