diff --git a/machine learning/Accuracy using SVM Model.png b/machine learning/Accuracy using SVM Model.png new file mode 100644 index 0000000..de793d0 Binary files /dev/null and b/machine learning/Accuracy using SVM Model.png differ diff --git a/machine learning/Data Visualization.py b/machine learning/Data Visualization.py new file mode 100644 index 0000000..79a91bb --- /dev/null +++ b/machine learning/Data Visualization.py @@ -0,0 +1,22 @@ +#Through this program, i am plotting the graph for comparison of year wise percentage of usage of bus. + +import numpy as np +import matplotlib.pyplot as plt + + +# creating the dataset +data = {'2015':71, '2016':81, '2017':84, + '2018':79, '2019':85} +courses = list(data.keys()) +values = list(data.values()) + +fig = plt.figure(figsize = (10, 5)) + +# creating the bar plot +plt.bar(courses, values, color ='maroon', + width = 0.4) + +plt.xlabel("Year wise Comparison") +plt.ylabel("Percentage Usage of Buses") +plt.title("Buses Usage Survey of 4 Years") +plt.show() diff --git a/machine learning/Face Original Image.png b/machine learning/Face Original Image.png new file mode 100644 index 0000000..ea56cfe Binary files /dev/null and b/machine learning/Face Original Image.png differ diff --git a/machine learning/Face_Mask Result Image.png b/machine learning/Face_Mask Result Image.png new file mode 100644 index 0000000..b2df389 Binary files /dev/null and b/machine learning/Face_Mask Result Image.png differ diff --git a/machine learning/Face_Mask _Program.py b/machine learning/Face_Mask _Program.py new file mode 100644 index 0000000..7748381 --- /dev/null +++ b/machine learning/Face_Mask _Program.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +"""FaceMask Program.ipynb + +Automatically generated by Colaboratory. + +Original file is located at + https://colab.research.google.com/drive/1nV51hyNEW5c_kN41Z_VruKXOlQMVR7TF + +Task - Face Mask Challange By Shubham Jha + +Problem - You are provided with some sample images along with this task. These are images extracted from a Celebrity Dataset to be used for segmentation. The task here though, is to crop the original image (named like 'xx.jpg') using it's corresponding mask provided (named like '000xx_skin.png'). +For a complete illustration see all cells below. + +For this task you should only use 'numpy' for the masking task. Please use standard image processing libraries like opencv, seaborn, matplotlib etc. + +Imports and Dependencies +""" + +import numpy as np +import pandas as pd +import cv2 as cv +from google.colab.patches import cv2_imshow # for image display +from skimage import io +from PIL import Image +import matplotlib.pylab as plt +import os +from sklearn.datasets import load_sample_images + +from PIL import Image +img = plt.imread('/content/FaceMaskData/62.jpg') +plt.imshow(img) +print(img.shape) + +img_face = cv2.imread('/content/FaceMaskData/62.jpg') +img_mask = cv2.imread('/content/FaceMaskData/00062_skin.png') +##Resizing images +img_face = cv2.resize(img_face, (400,400), interpolation = cv2.INTER_AREA) +img_mask = cv2.resize(img_mask, (400,400), interpolation = cv2.INTER_AREA) + + +for h in range(len(img_mask)): + for w in range(len(img_mask)): + if img_mask[h][w][0] == 0: + for i in range(3): + img_face[h][w][i] = 0 + else: + continue + +plt.imshow(img_face) + +from PIL import Image +img = plt.imread('/content/FaceMaskData/5.jpg') +plt.imshow(img) +print(img.shape) + +img_face = cv2.imread('/content/FaceMaskData/5.jpg') +img_mask = cv2.imread('/content/FaceMaskData/00005_skin.png') +##Resizing images +img_face = cv2.resize(img_face, (400,400), interpolation = cv2.INTER_AREA) +img_mask = cv2.resize(img_mask, (400,400), interpolation = cv2.INTER_AREA) + +for h in range(len(img_mask)): + for w in range(len(img_mask)): + if img_mask[h][w][0] == 0: + for i in range(3): + img_face[h][w][i] = 0 + else: + continue + +plt.imshow(img_face) diff --git a/machine learning/Required Dataset_SvmAlgorithm.png b/machine learning/Required Dataset_SvmAlgorithm.png new file mode 100644 index 0000000..4ad5e0c Binary files /dev/null and b/machine learning/Required Dataset_SvmAlgorithm.png differ diff --git a/machine learning/SvmAlgorithm.py b/machine learning/SvmAlgorithm.py new file mode 100644 index 0000000..2847924 --- /dev/null +++ b/machine learning/SvmAlgorithm.py @@ -0,0 +1,26 @@ +"""Implementation of SVM Algorithm Using Python - By Shubham Jha +""" + +from sklearn import svm, datasets +import matplotlib.pyplot as plt +import numpy as np +from sklearn.metrics import accuracy_score +from sklearn.model_selection import train_test_split + +iris = datasets.load_iris() + +X = iris.data[:, :12] # we will take twelve features +y = iris.target +x_train, x_test, y_train, y_test = train_test_split(X, y, random_state = 0, test_size = 0.25) + +clf = svm.SVC(kernel='linear', C=1).fit(x_train, y_train) + +import pandas as pd +Iris = pd.read_csv("/content/train_qnU1GcL.csv") +Iris.head(20) + +classifier_predictions = clf.predict(x_test) +print(accuracy_score(y_test, classifier_predictions)*100) + + +#Accuracy of this model is - 97.36842105263158