real-time-parking-occupancy-detection
real-time-parking-occupancy-detection copied to clipboard
extract_features_from_images.py where is this file plz?
From this notebook in "[23]"
ground_truth = []
prediction = []
for img in valid_images:
label = img.split("/")[-2]
if label == "Occupied":
ground_truth.append(1)
else:
ground_truth.append(0)
image = load_image(img)
image = cv2.resize(image, (WIDTH, HEIGHT))
image_x = np.expand_dims(image, axis=0)
image_x = preprocess_input(image_x)
pred = tf_model.predict(image_x)
pred = np.squeeze(pred)
if pred > 0.98:
prediction.append(1)
else:
prediction.append(0)
You can create valid dataset in this notebook with the code below.
valid_y = []
valid_x = []
for img in valid_images:
label = img.split("/")[-2]
if label == "Occupied":
valid_y.append(1)
else:
valid_y.append(0)
image = load_image(img)
image = cv2.resize(image, (WIDTH, HEIGHT))
image_x = np.expand_dims(image, axis=0)
image_x = preprocess_input(image_x)
pred = tf_model.predict(image_x)
pred = np.squeeze(pred)
valid_x.append(pred)
valid_x = np.array(valid_x)
valid_x = valid_x.reshape(-1, 1)
valid_y = np.array(valid_y)
This is the same way with the train dataset