Skip to content

Instantly share code, notes, and snippets.

View aishwarya-singh25's full-sized avatar

Aishwarya Singh aishwarya-singh25

View GitHub Profile
@aishwarya-singh25
aishwarya-singh25 / bounding_boxes.py
Created July 31, 2020 12:29
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
aishwarya-singh25 / backprop_convolv.py
Last active April 15, 2022 23:01
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]):
@aishwarya-singh25
aishwarya-singh25 / data_info.py
Last active January 16, 2020 11:39
pandas version 1.0
#loading data
import pandas as pd
data = pd.read_csv('train_LZdllcl.csv')
#data summary
data.info()
@aishwarya-singh25
aishwarya-singh25 / changing_dtype.py
Last active December 7, 2019 09:57
Time Series Features
import pandas as pd
data = pd.read_csv('Train_SU63ISt.csv')
data['Datetime'] = pd.to_datetime(data['Datetime'],format='%d-%m-%Y %H:%M')
data.dtypes
@aishwarya-singh25
aishwarya-singh25 / building_kmeans.py
Created October 25, 2019 08:28
Gaussian Mixture Models Implementation
#training k-means model
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=4)
kmeans.fit(data)
#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
aishwarya-singh25 / adjust_gamma.py
Last active November 14, 2023 17:50
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
aishwarya-singh25 / hog.py
Created August 29, 2019 07:56
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)
@aishwarya-singh25
aishwarya-singh25 / edge_features
Last active November 14, 2023 17:49
Image features
#importing the required libraries
import numpy as np
from skimage.io 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)