1593880560
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:
Before going to implement this technique we will see what are the dependency library and model needed.
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
1618317562
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
1603735200
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
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.
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.
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
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:
Before going to implement this technique we will see what are the dependency library and model needed.
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
1598002740
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.
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:
Tracking faces is history—tracking people is the future
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.
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:
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
1596328500
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.
Types of Images:
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.
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