野村  陽一

野村 陽一

1593880560

How to auto rotate the image using Deep learning!!!

The above image showed the input (left) and output (right). Let’s see how to auto rotate the image without manual rotation. These days, computer vision has evolved so much all over the world. I just played and implemented a small technique to auto rotate images using computer vision.

Steps to auto rotate the images:

  1. Read the input image.
  2. Detect Face by Caffe model.
  3. If the face is not detected then rotate the image.
  4. Again detect face with rotated images.
  5. Rotate the image with three angles until face detect.

Before going to implement this technique we will see what are the dependency library and model needed.

  1. OpenCV
  2. Numpy
  3. Caffe model(Deep learning)

Step 1:- Import all the above required libraries.

import cv2
import numpy as np

Step 2:- Download the Caffe model and file and prototxt file. Let us see why we need those two files and what that is.

What is the Caffe model file?

Caffe is a deep learning framework developed by the Berkeley Vision and Learning Center (BVLC). It is written in C++ and has Python and Matlab bindings. After training the model with our data set, we will get the trained model in a file with an extension.

What is deploy.prototxt file?

The prototxt is a text file that holds information about the structure of the neural network: A list of layers in the neural network. The parameters of each layer, such as its name, type, input dimensions, and output dimensions. The connections between the layers. That prototxt file is only to deploy the model and cannot be used to train it.

Step 3:- This is the main method to read an image file using OpenCV. Then pass image into detect_face method(Step 4) it will give you True(Detected) or False(Not Detected). If it returns FALSE then the image is not the correct angle hence we need to rotate the image angle as per below angles step by step.

Rotate Angle -> 90 -> 180 -> 270

Rotate angle

def main(): 
 frame = cv2.imread(‘6.jpg’)
 original_status = detect_face(frame)
 (h, w) = frame.shape[:2]
 # calculate the center of the image
 center = (w / 2, h / 2)
 scale = 1.0
 angle_90 = 90
 angle_180 = 180
 angle_270 = 270
 if original_status is None:
 status_90 = rotate_image(frame,center,scale,angle_90)
   if status_90 is None:
    status_180 = rotate_image(frame,center,scale,angle_180)
      if status_180 is None:
         status_270 = rotate_image(frame,center,scale, angle_270)

Step 4:- Here is the detect_face method to detect face using the Caffe model. We can use OpenCV dnn module to read Caffe models using the readNetFromCaffe method. Then convert our image into the blob to pass neural network based on output weight it will return probability values. I have used 0.7 as min accuracy values. if the value is more than that we can detect face images. The Caffe model was trained by right angle faces images so it will detect only if the face image is the correct angle.

def detect_face(frame):

net = cv2.dnn.readNetFromCaffe(‘deploy.prototxt’,        ‘res10_300x300_ssd_iter_140000.caffemodel’)

    (h, w) = frame.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(frame,(300,300)), 1.0,   (300,300), (104.0,177.0,123.0))
net.setInput(blob)
faces = net.forward()
for i in range(0, faces.shape[2]):
     confidence = faces[0,0,i,2]

    if confidence < 0.7:
      continue
box = faces[0,0,i,3:7] * np.array([w,h,w,h])
  (startX, startY, endX, endY) = box.astype(‘int’)
text = “face “ + “{:.2f}%”.format(confidence * 100)
cv2.imwrite(‘test.jpg’,frame)
    return True

**Step 5:-**Let us see how to rotate the image using OpenCV.

def rotate_image(frame,center,scale,angle):
 (h, w) = frame.shape[:2]
 M = cv2.getRotationMatrix2D(center, angle, scale)
 frame = cv2.warpAffine(frame, M, (h, w))
 return detect_face(frame)

#opencv #computer-vision #deep-learning #machine-learning #data-science #deep learning

What is GEEK

Buddha Community

How to auto rotate the image using Deep learning!!!

Top Deep Learning Development Services | Hire Deep Learning Developer

View more: https://www.inexture.com/services/deep-learning-development/

We at Inexture, strategically work on every project we are associated with. We propose a robust set of AI, ML, and DL consulting services. Our virtuoso team of data scientists and developers meticulously work on every project and add a personalized touch to it. Because we keep our clientele aware of everything being done associated with their project so there’s a sense of transparency being maintained. Leverage our services for your next AI project for end-to-end optimum services.

#deep learning development #deep learning framework #deep learning expert #deep learning ai #deep learning services

Mikel  Okuneva

Mikel Okuneva

1603735200

Top 10 Deep Learning Sessions To Look Forward To At DVDC 2020

The Deep Learning DevCon 2020, DLDC 2020, has exciting talks and sessions around the latest developments in the field of deep learning, that will not only be interesting for professionals of this field but also for the enthusiasts who are willing to make a career in the field of deep learning. The two-day conference scheduled for 29th and 30th October will host paper presentations, tech talks, workshops that will uncover some interesting developments as well as the latest research and advancement of this area. Further to this, with deep learning gaining massive traction, this conference will highlight some fascinating use cases across the world.

Here are ten interesting talks and sessions of DLDC 2020 that one should definitely attend:

Also Read: Why Deep Learning DevCon Comes At The Right Time


Adversarial Robustness in Deep Learning

By Dipanjan Sarkar

**About: **Adversarial Robustness in Deep Learning is a session presented by Dipanjan Sarkar, a Data Science Lead at Applied Materials, as well as a Google Developer Expert in Machine Learning. In this session, he will focus on the adversarial robustness in the field of deep learning, where he talks about its importance, different types of adversarial attacks, and will showcase some ways to train the neural networks with adversarial realisation. Considering abstract deep learning has brought us tremendous achievements in the fields of computer vision and natural language processing, this talk will be really interesting for people working in this area. With this session, the attendees will have a comprehensive understanding of adversarial perturbations in the field of deep learning and ways to deal with them with common recipes.

Read an interview with Dipanjan Sarkar.

Imbalance Handling with Combination of Deep Variational Autoencoder and NEATER

By Divye Singh

**About: **Imbalance Handling with Combination of Deep Variational Autoencoder and NEATER is a paper presentation by Divye Singh, who has a masters in technology degree in Mathematical Modeling and Simulation and has the interest to research in the field of artificial intelligence, learning-based systems, machine learning, etc. In this paper presentation, he will talk about the common problem of class imbalance in medical diagnosis and anomaly detection, and how the problem can be solved with a deep learning framework. The talk focuses on the paper, where he has proposed a synergistic over-sampling method generating informative synthetic minority class data by filtering the noise from the over-sampled examples. Further, he will also showcase the experimental results on several real-life imbalanced datasets to prove the effectiveness of the proposed method for binary classification problems.

Default Rate Prediction Models for Self-Employment in Korea using Ridge, Random Forest & Deep Neural Network

By Dongsuk Hong

About: This is a paper presentation given by Dongsuk Hong, who is a PhD in Computer Science, and works in the big data centre of Korea Credit Information Services. This talk will introduce the attendees with machine learning and deep learning models for predicting self-employment default rates using credit information. He will talk about the study, where the DNN model is implemented for two purposes — a sub-model for the selection of credit information variables; and works for cascading to the final model that predicts default rates. Hong’s main research area is data analysis of credit information, where she is particularly interested in evaluating the performance of prediction models based on machine learning and deep learning. This talk will be interesting for the deep learning practitioners who are willing to make a career in this field.


#opinions #attend dldc 2020 #deep learning #deep learning sessions #deep learning talks #dldc 2020 #top deep learning sessions at dldc 2020 #top deep learning talks at dldc 2020

野村  陽一

野村 陽一

1593880560

How to auto rotate the image using Deep learning!!!

The above image showed the input (left) and output (right). Let’s see how to auto rotate the image without manual rotation. These days, computer vision has evolved so much all over the world. I just played and implemented a small technique to auto rotate images using computer vision.

Steps to auto rotate the images:

  1. Read the input image.
  2. Detect Face by Caffe model.
  3. If the face is not detected then rotate the image.
  4. Again detect face with rotated images.
  5. Rotate the image with three angles until face detect.

Before going to implement this technique we will see what are the dependency library and model needed.

  1. OpenCV
  2. Numpy
  3. Caffe model(Deep learning)

Step 1:- Import all the above required libraries.

import cv2
import numpy as np

Step 2:- Download the Caffe model and file and prototxt file. Let us see why we need those two files and what that is.

What is the Caffe model file?

Caffe is a deep learning framework developed by the Berkeley Vision and Learning Center (BVLC). It is written in C++ and has Python and Matlab bindings. After training the model with our data set, we will get the trained model in a file with an extension.

What is deploy.prototxt file?

The prototxt is a text file that holds information about the structure of the neural network: A list of layers in the neural network. The parameters of each layer, such as its name, type, input dimensions, and output dimensions. The connections between the layers. That prototxt file is only to deploy the model and cannot be used to train it.

Step 3:- This is the main method to read an image file using OpenCV. Then pass image into detect_face method(Step 4) it will give you True(Detected) or False(Not Detected). If it returns FALSE then the image is not the correct angle hence we need to rotate the image angle as per below angles step by step.

Rotate Angle -> 90 -> 180 -> 270

Rotate angle

def main(): 
 frame = cv2.imread(‘6.jpg’)
 original_status = detect_face(frame)
 (h, w) = frame.shape[:2]
 # calculate the center of the image
 center = (w / 2, h / 2)
 scale = 1.0
 angle_90 = 90
 angle_180 = 180
 angle_270 = 270
 if original_status is None:
 status_90 = rotate_image(frame,center,scale,angle_90)
   if status_90 is None:
    status_180 = rotate_image(frame,center,scale,angle_180)
      if status_180 is None:
         status_270 = rotate_image(frame,center,scale, angle_270)

Step 4:- Here is the detect_face method to detect face using the Caffe model. We can use OpenCV dnn module to read Caffe models using the readNetFromCaffe method. Then convert our image into the blob to pass neural network based on output weight it will return probability values. I have used 0.7 as min accuracy values. if the value is more than that we can detect face images. The Caffe model was trained by right angle faces images so it will detect only if the face image is the correct angle.

def detect_face(frame):

net = cv2.dnn.readNetFromCaffe(‘deploy.prototxt’,        ‘res10_300x300_ssd_iter_140000.caffemodel’)

    (h, w) = frame.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(frame,(300,300)), 1.0,   (300,300), (104.0,177.0,123.0))
net.setInput(blob)
faces = net.forward()
for i in range(0, faces.shape[2]):
     confidence = faces[0,0,i,2]

    if confidence < 0.7:
      continue
box = faces[0,0,i,3:7] * np.array([w,h,w,h])
  (startX, startY, endX, endY) = box.astype(‘int’)
text = “face “ + “{:.2f}%”.format(confidence * 100)
cv2.imwrite(‘test.jpg’,frame)
    return True

**Step 5:-**Let us see how to rotate the image using OpenCV.

def rotate_image(frame,center,scale,angle):
 (h, w) = frame.shape[:2]
 M = cv2.getRotationMatrix2D(center, angle, scale)
 frame = cv2.warpAffine(frame, M, (h, w))
 return detect_face(frame)

#opencv #computer-vision #deep-learning #machine-learning #data-science #deep learning

Tia  Gottlieb

Tia Gottlieb

1598002740

Changing Image Backgrounds Using Image Segmentation & Deep Learning

Hello readers! In this article I’ll be discussing another cool trick we can do with deep learning. Specifically, we’ll see how to change the background in an image or in a video, just like they do in news rooms and in movies. In those cases they use (expensive and bulky) green screens to achieve this task.

Image for post

We’ll simply be using the magic of deep learning to achieve that feat.

I have explained a bit about how we can make a computer intelligent and make it do some unbelievable stuff on images or videos using convolutional neural networks (CNNs) in my previous blog, where I gave an overview about how we can make use of these CNNsto track people in a video:

How to Track People Using Deep Learning

Tracking faces is history—tracking people is the future

heartbeat.fritz.ai

In this effort to change image/video frame backgrounds, we’ll be using image segmentation an image matting. I’ll provide a brief overview of both tasks, and then I’ll explain how to combine them.

Overview: Image Segmentation

Image segmentation is, essentially, a classification task in which we classify each pixel as belonging to one of the target classes. So when you pass an image through a segmentation model, it will give one label to each of the pixels that present in the image.

If we then color each pixel based on the class that pixel belongs to, we’ll be able to easily locate objects and their boundaries. Here’s what this looks like in practice:

Image for post

Fig 1

The image on the left is the input image, and the one on the right is the output. As you can see, each pixel belonging to a particular target class is a different color. In this case, pixels belonging to houses are red, and pixels belonging to the non-road ground is blue.

#image-segmentation #heartbeat #machine-learning #programming #deep-learning #deep learning

Agnes  Sauer

Agnes Sauer

1596328500

All about images -Types of Images:

Everything we see around us is nothing but an Image. we capture them using our mobile camera. In Signal Processing terms, Image is a signal which conveys some information. First I will tell you about what is a signal? how many types are they? Later part of this blog I will tell you about the images.

We are saying that image is signal. Signals are carry some information. It may be useful information or random noise. In Mathematics, Signal is function which depends on independent variables. The variables which are responsible for the altering the signal are called independent Variables. we have multidimensional signals. Here you will know about only three types of signals which are mainly used in edge cutting techniques such as Image processing, Computer Vision, Machine Learning, Deep Learning.

  • 1D signal: Signals which has only one independent variable. Audio signals are the perfect example. It depends on the time. For instance, if you change time of an audio clip, you will listen sound at that particular time.
  • 2D signal: Signals which depends on two independent variables. Image is an 2D signal as its information is only depends on its length and width.
  • 3D signals : Signals which depends on three independent variables. Videos are the best examples for this. It is just motion of images with respect to time. Here image’s length and width are two independent variables and time is the third one.

Types of Images:

  • Analog Images: These are natural images. The images which we see with our eye all are Analog image such as all physical objects. It has continuous values. Its amplitude is infinite.
  • **Digital images: **By quantizing the analog images we can produce the digital images. But now-a-days, mostly all cameras produce digital images only. In digital Images, All values are discrete. Each location will have finite amplitude. Mostly we are using digital images for processing.

Image for post

Image for post

Every digital image will have group of pixels. Its coordinate system is starts from top coroner

Digital images contains stack of small rectangles. Each rectangle we call as Pixel. Pixel is the smallest unit in the image.Each Pixel will have particular value that is intensity. this intensity value is produced by the combination of colors. We have millions of colors. But our eye is perceive only three colors and their combinations. Those color we call primary colors i.e., Red, Green and Blue.

Image for post

Image for post

Why only those three colors ???

Do not think much. the reason is as our human eye has only three color receptors. Different combinations in the stimulation of the receptors enable the human eye to distinguish nearly 350000 colors

Lets move to our image topic:

As of now, we knew that image intensity values is combination of Red, Green and Blue. Each pixel in color image will have these three color channels. Generally, we represent each color value in 8 bits i.e., one byte.

Now, you can say how many bits will require at each pixel. We have 3 colors at each pixel and each color value will be stored in 8 bits. Then each pixel will have 24 bits. This 24 bit color image will display 2**24 different colors.

Now you have a question. how much memory does it require to store RGB image of shape 256*256 ???I think so explanation is not required, if you want to clear explanation please comment below.

#machine-learning #computer-vision #image-processing #deep-learning #image #deep learning