Skip to content

Commit 4963e78

Browse files
committed
Refactored
1 parent 113211e commit 4963e78

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

load_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def imgload(self):
2424
# print(file+" "+str(i))
2525
img = cv2.imread(path+'/'+file, -1)
2626

27-
img = cv2.resize(img, (self.width,self.height))
27+
img = cv2.resize(img, (self.width, self.height))
2828
img = img_to_array(img)
2929
self.data.append(img)
3030
self.labels.append(i)

model_trainer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
trainX, testX, trainY, testY = train_test_split(data, labels, test_size=0.1, random_state=42)
2828
trainY = to_categorical(trainY, num_classes=3)
2929
testY = to_categorical(testY, num_classes=3)
30-
aug = ImageDataGenerator(rotation_range=30, width_shift_range=0.1, height_shift_range=0.1, shear_range=0.2, zoom_range=0.2, fill_mode="nearest")
30+
aug = ImageDataGenerator(rotation_range=30, width_shift_range=0.1, height_shift_range=0.1, shear_range=0.2,
31+
zoom_range=0.2, fill_mode="nearest")
3132
opt = Adam(lr=learning_rate, decay=learning_rate/epochs)
3233
model.compile(loss="categorical_crossentropy", optimizer=opt, metrics=["accuracy"])
33-
h = model.fit_generator(aug.flow(trainX, trainY, batch_size=bs), validation_data=(testX, testY), steps_per_epoch=len(trainX)//bs, epochs=epochs, verbose=1)
34+
h = model.fit_generator(aug.flow(trainX, trainY, batch_size=bs), validation_data=(testX, testY),
35+
steps_per_epoch=len(trainX)//bs, epochs=epochs, verbose=1)
3436
model.save("blind_with_regularization.model")

video2image(data Generator).py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ret, frame = cap.read()
99
frame = cv2.resize(frame, (640, 480))
1010
cv2.imshow('s', frame)
11-
if i%5 == 0:
11+
if i % 5 == 0:
1212
cv2.imwrite('C:/Users/satinder/Desktop/center/'+str(j)+'.jpg', frame)
1313
j = j+1
1414
i = i+1

0 commit comments

Comments
 (0)