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

Long-Polling vs WebSockets vs Server-Sent Events

Long-Polling vs WebSockets vs Server-Sent Events  Long-Polling, WebSockets, and Server-Sent Events are popular communication protocols between a client like a web browser and a web server. First, let’s start with understanding what a standard HTTP web request looks like. Following are a sequence of events for regular HTTP request: Client opens a connection and requests data from the server. The server calculates the response. The server sends the response back to the client on the opened request. HTTP Protocol Ajax Polling Polling is a standard technique used by the vast majority of AJAX applications. The basic idea is that the client repeatedly polls (or requests) a server for data. The client makes a request and waits for the server to respond with data. If no data is available, an empty response is returned. Client opens a connection and requests data from the server using regular HTTP. The requested webpage sends requests to the server at

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

Face Detection model on Image/Webcam/Video using Machine Learning OpenCV

Face detection is a computer technology that is being applied for many different applications that require the identification of human faces in digital images or video. It can be regarded as a specific case of object-class detection, where the task is to find the locations and sizes of all objects in an image that belongs to a given class. The technology is able to detect frontal or near-frontal faces in a photo, regardless of orientation, lighting conditions or skin color . Not Face Recognition! It’s about Detection. Face recognition describes a biometric technology that goes way beyond recognizing when a human face is present. It actually attempts to establish whose face it is. In this article, I’m not going deep into recognizing. I’ll keep that for a future blog article and for the time being, I’m going to explain how to run a simple Face  Detection program using your WebCam with Python Or we can run simple program on image as well . We are dealing with below Cascade models for fac