Skip to content

Commit

Permalink
committing v5 and v6 ( final code used in demo)
Browse files Browse the repository at this point in the history
Our prototype succeeded and got the top award from project invent, the "moonshot" award, for the most novel and impactful idea for the pacific region of the competition. We got 500 dollars of initial VC funding as our award.
  • Loading branch information
SoKul-13 committed May 15, 2023
1 parent a3939c0 commit 64bd1b5
Show file tree
Hide file tree
Showing 19 changed files with 1,538 additions and 125 deletions.
32 changes: 16 additions & 16 deletions fileresize.py → v4/fileresize.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from PIL import Image
import os
import argparse

def rescale_images (directory,size):
for img in os.listdir(directory):
im = Image.open(directory+img)
im_resized = im.resize(size, Image.ANTIALIAS)
im_resized.save(directory+img)

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Rescale Images")
parser.add_argument('-d', '--directory', type=str, required=True, help='Dir')
parser.add_argument('-s', '--size', type=int,nargs=2, required=True, metavar=int)
args = parser.parse_args()
rescale_images(args.directory, args.size)
from PIL import Image
import os
import argparse

def rescale_images (directory,size):
for img in os.listdir(directory):
im = Image.open(directory+img)
im_resized = im.resize(size, Image.ANTIALIAS)
im_resized.save(directory+img)

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Rescale Images")
parser.add_argument('-d', '--directory', type=str, required=True, help='Dir')
parser.add_argument('-s', '--size', type=int,nargs=2, required=True, metavar=int)
args = parser.parse_args()
rescale_images(args.directory, args.size)
76 changes: 38 additions & 38 deletions main.py → v4/main.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@

import pyttsx3
from gpiozero import Button
from gpiozero import Buzzer
from time import sleep

button = Button(11)
motor1 = Buzzer(12)
motor2 = Buzzer(13)
motor3 = Buzzer(16)
text_speech = pyttsx3.init()
all = 0
bathroom = 1
chair = 2
door = 3
counter = 0
mode = counter%4



#while True:
# if button.is_pressed:
# if (mode == all):
# text_speech.say("all")
# text_speech.runAndWait()
## elif(mode == bathroom):
# text_speech.say("bathroom")
# text_speech.runAndWait()
# elif(mode == chair):
# text_speech.say("chair")
# text_speech.runAndWait()
# elif(mode == door):
# text_speech.say("door")
# text_speech.runAndWait()
# counter += 1
# else:
# print(".")
# sleep(1)

import pyttsx3
from gpiozero import Button
from gpiozero import Buzzer
from time import sleep

button = Button(11)
motor1 = Buzzer(12)
motor2 = Buzzer(13)
motor3 = Buzzer(16)
text_speech = pyttsx3.init()
all = 0
bathroom = 1
chair = 2
door = 3
counter = 0
mode = counter%4



#while True:
# if button.is_pressed:
# if (mode == all):
# text_speech.say("all")
# text_speech.runAndWait()
## elif(mode == bathroom):
# text_speech.say("bathroom")
# text_speech.runAndWait()
# elif(mode == chair):
# text_speech.say("chair")
# text_speech.runAndWait()
# elif(mode == door):
# text_speech.say("door")
# text_speech.runAndWait()
# counter += 1
# else:
# print(".")
# sleep(1)
70 changes: 35 additions & 35 deletions newparse.py → v4/newparse.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#from tensorflow.keras import Sequential
#from tensorflow.keras.layers import Flatten, Dense, Conv2D, MaxPooling2D, Dropout
import numpy as np
import pandas as pd
import cv2
import random
from pathlib import Path
from tqdm import tqdm
#from tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
from keras.utils import to_categorical
import numpy as np
#from sklearn.mode_selection import train_test_split
import os


labels = []
ds_dir = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doorimages/"

image_size = 224 # Define the image size here

def create_dataset(category, label, dataset):
for img in tqdm(category):
image_path = os.path.join(ds_dir, img)
try:
image = cv2.imread(image_path,cv2.IMREAD_COLOR)
image = cv2.resize(image,(image_size, image_size))
except:
continue
dataset.append([np.array(image),np.array(label)])
random.shuffle(dataset)
return dataset
trash = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/trash/"
door = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doortestimages/"
dataset = []
dataset = create_dataset(trash, 1, dataset)
#from tensorflow.keras import Sequential
#from tensorflow.keras.layers import Flatten, Dense, Conv2D, MaxPooling2D, Dropout
import numpy as np
import pandas as pd
import cv2
import random
from pathlib import Path
from tqdm import tqdm
#from tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
from keras.utils import to_categorical
import numpy as np
#from sklearn.mode_selection import train_test_split
import os


labels = []
ds_dir = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doorimages/"

image_size = 224 # Define the image size here

def create_dataset(category, label, dataset):
for img in tqdm(category):
image_path = os.path.join(ds_dir, img)
try:
image = cv2.imread(image_path,cv2.IMREAD_COLOR)
image = cv2.resize(image,(image_size, image_size))
except:
continue
dataset.append([np.array(image),np.array(label)])
random.shuffle(dataset)
return dataset
trash = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/trash/"
door = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doortestimages/"
dataset = []
dataset = create_dataset(trash, 1, dataset)
dataset = create_dataset(door, 2, dataset)
72 changes: 36 additions & 36 deletions parsefile.py → v4/parsefile.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import os


def save_image(like_value, photo, img):
filename = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/"

# body like
if like_value == 's':
print('doorimages')
filename += "doortestimages/" + photo
plt.imsave(filename, img)

# body dislike
if like_value == 'd':
print('notdoor')
filename += 'trash/' + photo
plt.imsave(filename, img)

def main():
base_path = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doorimages/"
for photo in os.listdir(base_path):
photo_path = base_path + photo
img = mpimg.imread(photo_path)
plt.imshow(img)
plt.show()

like_value = input()

# save pic to new folder and delete it from 'to_label' folder
save_image(like_value, photo, img)
os.remove(photo_path)


if __name__ == "__main__":
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import os


def save_image(like_value, photo, img):
filename = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/"

# body like
if like_value == 's':
print('doorimages')
filename += "doortestimages/" + photo
plt.imsave(filename, img)

# body dislike
if like_value == 'd':
print('notdoor')
filename += 'trash/' + photo
plt.imsave(filename, img)

def main():
base_path = "C:/Users/Soham Kulkarni/OneDrive/Documents/GitHub/vechtor/v4/doorimages/"
for photo in os.listdir(base_path):
photo_path = base_path + photo
img = mpimg.imread(photo_path)
plt.imshow(img)
plt.show()

like_value = input()

# save pic to new folder and delete it from 'to_label' folder
save_image(like_value, photo, img)
os.remove(photo_path)


if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 64bd1b5

Please sign in to comment.