Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ###IMPORTING LIBRARIES### | |
| import cv2 | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import os | |
| from tqdm import tqdm | |
| %matplotlib inline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Z,X=[],[] | |
| IMG_SIZE=150 | |
| FLOWER_SUNFLOWER_DIR='../input/flowers-recognition/flowers/flowers/sunflower' | |
| def assign_label(img,flower_type): | |
| return flower_type | |
| def make_train_data(flower_type,DIR): | |
| for img in tqdm(os.listdir(DIR)): | |
| label=assign_label(img,flower_type) | |
| path = os.path.join(DIR,img) | |
| img = cv2.imread(path,cv2.IMREAD_COLOR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| make_train_data('Sunflower',FLOWER_SUNFLOWER_DIR) #####Loading Sunflower Data | |
| fix_img = cv2.cvtColor(X[0],cv2.COLOR_BGR2RGB) ###########CONVERTING BGR COLOR SPACE INTO RGB COLOR SPACE ######### | |
| new_img_1 = fix_img.copy() | |
| new_img_2 = fix_img.copy() | |
| new_img_3 = fix_img.copy() | |
| new_img_1[:,:,0] = 0 # making R channel zero ####For BLUE channel##### | |
| new_img_1[:,:,1] = 0 #making G channel zero | |
| new_img_2[:,:,1] = 0####For RED color Channel#### | |
| new_img_2[:,:,2] = 0 | |
| new_img_3[:,:,0] = 0###For GREEN Channel#### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f, axes = plt.subplots(1,3, figsize = (15,15)) | |
| list = [new_img_1,new_img_2,new_img_3] | |
| i = 0 | |
| for ax in axes: | |
| ax.imshow(list[i]) | |
| i+=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hsl_img = cv2.cvtColor(X[0],cv2.COLOR_BGR2HLS) #### CONVERTING BGR COLOR SPACE INTO HSL COLOR SPACE #### | |
| hsl_img_1 = hsl_img.copy() | |
| hsl_img_2 = hsl_img.copy() | |
| hsl_img_3 = hsl_img.copy() | |
| hsl_img_1[:,:,1] = 0 #### HUE --> ZERO #### | |
| hsl_img_1[:,:,2] = 0 | |
| hsl_img_2[:,:,0] = 0 #### SATURATION --> ZERO #### | |
| hsl_img_2[:,:,2] = 0 | |
| hsl_img_3[:,:,0] = 0 #### LIGHTNESS --> ZERO #### | |
| hsl_img_3[:,:,1] = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f, axes = plt.subplots(1,3, figsize = (15,15)) | |
| list = [hsl_img_1,hsl_img_2,hsl_img_3] | |
| i = 0 | |
| for ax in axes: | |
| ax.imshow(list[i]) | |
| i+=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hsv_img = cv2.cvtColor(X[0],cv2.COLOR_BGR2HSV) | |
| hsv_img_1 = hsv_img.copy() | |
| hsv_img_2 = hsv_img.copy() | |
| hsv_img_3 = hsv_img.copy() | |
| hsv_img_1[:,:,1] = 0#HUE --> ZERO | |
| hsv_img_1[:,:,2] = 0 | |
| hsv_img_2[:,:,0] = 0#SATURATION --> ZERO | |
| hsv_img_2[:,:,2] = 0 | |
| hsv_img_3[:,:,0] = 0#VALUE --> ZERO | |
| hsv_img_3[:,:,1] = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f, axes = plt.subplots(1,3, figsize = (15,15)) | |
| list = [hsv_img_1,hsv_img_2,hsv_img_3] | |
| i = 0 | |
| for ax in axes: | |
| ax.imshow(list[i]) | |
| i+=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pickle | |
| import time | |
| import pandas as pd | |
| from selenium import webdriver | |
| import selenium.webdriver.support.ui as ui | |
| def get_list(tags) -> str: | |
| '''Converts list of tags to data string.''' |
OlderNewer