Skip to content

Instantly share code, notes, and snippets.

aishwarya-singh25 /
Created Jul 31, 2020
Non max suppression implementation
import matplotlib.pyplot as plt
import matplotlib.patches as patches
image = plt.imread('index.jpg')
# draw emtpy figure
fig = plt.figure()
# define axis
ax = fig.add_axes([0, 0, 1, 1])
aishwarya-singh25 /
Last active Apr 15, 2022
CNN from scratch using numpy
filter_update = []
for i in range(f.shape[2]):
for j in range(f.shape[0]):
for k in range(f.shape[1]):
temp = 0
spos_row = j
spos_col = k
epos_row = spos_row + s_row
epos_col = spos_col + s_col
for l in range(X.shape[2]):
#loading data
import pandas as pd
data = pd.read_csv('train_LZdllcl.csv')
#data summary
import pandas as pd
data = pd.read_csv('Train_SU63ISt.csv')
data['Datetime'] = pd.to_datetime(data['Datetime'],format='%d-%m-%Y %H:%M')
aishwarya-singh25 /
Created Oct 25, 2019
Gaussian Mixture Models Implementation
#training k-means model
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=4)
#predictions from kmeans
pred = kmeans.predict(data)
frame = pd.DataFrame(data)
frame['cluster'] = pred
frame.columns = ['Weight', 'Height', 'cluster']
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
# read images
img1 = cv2.imread('eiffel_2.jpeg')
img2 = cv2.imread('eiffel_1.jpg')
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
aishwarya-singh25 /
Last active Sep 14, 2021
Preprocessing Techniques
from skimage import exposure
#adjusting brightness
image = imread('images.jpeg')
image_bright = exposure.adjust_gamma(image, gamma=0.5,gain=1)
image_dark = exposure.adjust_gamma(image, gamma=1.5,gain=1)
# plotting images
plt.subplot(131), imshow(image)
plt.title('Original Image')
aishwarya-singh25 /
Created Aug 29, 2019
HOG feature Descriptor
#creating hog features
fd, hog_image = hog(resized_img, orientations=9, pixels_per_cell=(8, 8),
cells_per_block=(2, 2), visualize=True, multichannel=True)
View edge_features
#importing the required libraries
import numpy as np
from import imread, imshow
from skimage.filters import prewitt_h,prewitt_v
import matplotlib.pyplot as plt
%matplotlib inline
#reading the image
image = imread('puppy.jpeg',as_gray=True)