MinY Project
- Preprocessing the Dataset
• An Imagenet Dataset ( Zip File consisting of train,test,valid folders)
• Test data : 495 , train : 3468 , valid : 990 (No of images)
• Test:Train:Validation ratio => 10:70:20
• Test:train => 12:88
Process :
I used Aws EC2 environment , I used Winscp program & Lmdb python binding to preprocess the data.
I used histogram Equalization technique to adjust contrast and resize the image data
def transform_img(img, img_width=IMAGE_WIDTH, img_height=IMAGE_HEIGHT):
#Histogram Equalization
img[:, :, 0] = cv2.equalizeHist(img[:, :, 0])
img[:, :, 1] = cv2.equalizeHist(img[:, :, 1])
img[:, :, 2] = cv2.equalizeHist(img[:, :, 2])
#Image Resizing
img = cv2.resize(img, (img_width, img_height), interpolation = cv2.INTER_CUBIC)
def transform_img(img, img_width=IMAGE_WIDTH, img_height=IMAGE_HEIGHT):
#Histogram Equalization
img[:, :, 0] = cv2.equalizeHist(img[:, :, 0])
img[:, :, 1] = cv2.equalizeHist(img[:, :, 1])
img[:, :, 2] = cv2.equalizeHist(img[:, :, 2])
#Image Resizing
img = cv2.resize(img, (img_width, img_height), interpolation = cv2.INTER_CUBIC)
return img\
Program for Image transformation during preprocessing
• make_datum takes an image and its label and return a Datum object that contains the image and its label.
• datum is a csv alternative offered by caffe.\
- CNN Model Training\
• We used mobilenet model, (prototxt file in folder)
• After model training // “--solver” command to start training
• After training our datum will be modified into filename.caffemodel
• By using “—weights” command we can pass the weights to model\