I am working on a project for "Mood Detection".
As the first step of making a complete product we have started with image processing. I have learned from the Internet that a Convolution-Neural-Network is the best approach.
import cv2
import numpy as np
def sum_cnn(image,x,y):
x1,y1=np.shape(image)
temp=image
for i in range(0,x1-x):
for j in range(0,y1-y):
temp1=np.sum(image[i:i+x,j:j+y])/(x*y)
if temp1 in range(850000,1100000):
cv2.rectangle(temp, (i, j), (i+20, j+20), (0, 255, 0), 2)
print "\n"
return temp
image =cv2.imread('test.jpg')
image=cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
image=np.matrix(image)
temp=sum_cnn(image,95,95)
cv2.imshow('Processed Video', temp)
cv2.imwrite('1.jpg',temp)
print "Done"
Above is the code I have written - the value (850000,1100000) is the value of the sum of a convoluted range of the Matrix (sorry the code is very crude, I started writing it this morning).
Well the question that I am asking is how to design or obtain a matrix which is going to store the weights.
1) Can I make do with just one matrix for every kind of object detection (i.e. a crude single layered CNN, which will give a different value for a "Car" and a "Face") OR should I have separate matrix for a "Car" and a "Face"?
2) How to deal with different sizes of the same object? One solution I saw on the Internet is to keep resizing the original image. I would like to know if there is a faster approach?
3) In back propagation what are a crude conditions that we give to get an optimized weights matrix?