# Develop a simple image classification system by using Laplacian of Gaussian (LoG)

I am tring to write a simple CAD system to classify some images within two groups by using Laplacian of Gaussian (LoG). I am using scikit-image for this tasks and I want to use DNN in keras to train a classifer.

The problem is that I am not sure how to create feature list by using LOG.

My images could have different sizes so LOG could have different feature set.

I am using below codes

from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray

img1T = Image.open( "C:\Users\Public\h1T.jpg")
img2T=Image.open( "C:\Users\Public\h2T.jpg")
data_img1T = np.asarray( img1T , dtype='uint8' )
data_img2T= np.asarray( img2T, dtype='uint8' )
data_gray_img1T = rgb2gray(data_img1T)
data_gray_img2T = rgb2gray(data_img2T)

blobs_log_img1T = blob_log(data_gray_img1T, max_sigma=30, num_sigma=10, threshold=.1)
blobs_log_img2T = blob_log(data_gray_img2T, max_sigma=30, num_sigma=10, threshold=.1)


when getting the LOG feature for tow images:

>>> blobs_log_img1T.shape
(73L, 3L)
>>> blobs_log_img2T.shape
(51L, 3L)


now these two images have different shapes, but I need to find a way to use identical number of features for all images. Do I have to resize images to be of identical sizes or I have to take another approach?

Thanks,

## 1 Answer

The two simplest ideas are probably to either pad the smaller images with a constant pixel value to a common shape, or crop the bigger images to a common shape.

In the first case, you will however likely end up with a network biased towards padded images/samples with constant pixel value areas. In the second case, you loose possibly prominent information with respect to your classification task.

You could also use the cropping approach with several crops per image in order to avoid loss of information in your data set, leading to an increased proportion of the classes associated with bigger images in your training set. This also biases your neural network (this could be more or loss controlled thanks to appropriate weights attached to the classes' samples during training, if you can predict the imbalance before training, cf. this towardsdatascience article to read about training with imbalanced classes, with Keras code).

Those questions were raised and discussed in this SO post.