Skip to content

Commit

Permalink
Added in room detector weights
Browse files Browse the repository at this point in the history
  • Loading branch information
willow-carroll-polzin committed Sep 4, 2022
1 parent 7d65cc3 commit cf34b73
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
9 changes: 9 additions & 0 deletions models/nn1_yoloact/room_classifier/keras_metadata.pb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

�0root"_tf_keras_sequential*�/{"name": "sequential", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 2204, 1]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "Input_Layer"}}, {"class_name": "Flatten", "config": {"name": "flatten", "trainable": true, "dtype": "float32", "data_format": "channels_last"}}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_1", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_2", "trainable": true, "dtype": "float32", "units": 32, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_4", "trainable": true, "dtype": "float32", "units": 10, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "Output_Layer", "trainable": true, "dtype": "float32", "units": 7, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "shared_object_id": 14, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, 2204, 1]}, "ndim": 3, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, 2204, 1]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 2204, 1]}, "float32", "Input_Layer"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 2204, 1]}, "float32", "Input_Layer"]}, "keras_version": "2.8.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 2204, 1]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "Input_Layer"}, "shared_object_id": 0}, {"class_name": "Flatten", "config": {"name": "flatten", "trainable": true, "dtype": "float32", "data_format": "channels_last"}, "shared_object_id": 1}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_1", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_2", "trainable": true, "dtype": "float32", "units": 32, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7}, {"class_name": "Dense", "config": {"name": "Hidden_Layer_4", "trainable": true, "dtype": "float32", "units": 10, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10}, {"class_name": "Dense", "config": {"name": "Output_Layer", "trainable": true, "dtype": "float32", "units": 7, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13}]}}, "training_config": {"loss": {"class_name": "SparseCategoricalCrossentropy", "config": {"reduction": "auto", "name": "sparse_categorical_crossentropy", "from_logits": false}, "shared_object_id": 16}, "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "accuracy", "dtype": "float32", "fn": "sparse_categorical_accuracy"}, "shared_object_id": 17}]], "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.0010000000474974513, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}2
� root.layer-0"_tf_keras_layer*�{"name": "flatten", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Flatten", "config": {"name": "flatten", "trainable": true, "dtype": "float32", "data_format": "channels_last"}, "shared_object_id": 1, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 1, "axes": {}}, "shared_object_id": 18}}2
�root.layer_with_weights-0"_tf_keras_layer*�{"name": "Hidden_Layer_1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "Hidden_Layer_1", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 2204}}, "shared_object_id": 19}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 2204]}}2
�root.layer_with_weights-1"_tf_keras_layer*�{"name": "Hidden_Layer_2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "Hidden_Layer_2", "trainable": true, "dtype": "float32", "units": 32, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 64}}, "shared_object_id": 20}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 64]}}2
�root.layer_with_weights-2"_tf_keras_layer*�{"name": "Hidden_Layer_4", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "Hidden_Layer_4", "trainable": true, "dtype": "float32", "units": 10, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 32}}, "shared_object_id": 21}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 32]}}2
�root.layer_with_weights-3"_tf_keras_layer*�{"name": "Output_Layer", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "Output_Layer", "trainable": true, "dtype": "float32", "units": 7, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 10}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 10]}}2
�Yroot.keras_api.metrics.0"_tf_keras_metric*�{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 23}2
�Zroot.keras_api.metrics.1"_tf_keras_metric*�{"class_name": "MeanMetricWrapper", "name": "accuracy", "dtype": "float32", "config": {"name": "accuracy", "dtype": "float32", "fn": "sparse_categorical_accuracy"}, "shared_object_id": 17}2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added models/trained_data/listOfAllObj_v3.pkl
Binary file not shown.
Binary file added models/trained_data/uniqueObjs_v3.pkl
Binary file not shown.
2 changes: 1 addition & 1 deletion object_detection/object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This method uses YOLACT trained on the COCO dataset to detect objects
from RGB camera frames.
"""
def objectDetector(image, model):
def objectDetector(frames):
#Run YOLACT and save detections as a PKL

return
10 changes: 3 additions & 7 deletions object_retrieval_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
NN1_OD_DIRECTORY = '/weights/object_detector/' #Object detector
NN2_RD_DIRECTORY = '/weights/room_classifier/' #Room detector/guessor
TEST_DATASET = '/gdrive/My Drive/Colab Notebooks/SYSC 5906/datasets/mit_indoors/processed/data_labelsOnly/'
PICKLE_DIRECTORY = '/models/trained_data/data_labelsOnly/'
RD_TRAINED_DATA_DIRECTORY = '/models/trained_data/data_labelsOnly/'

#Import libraries and scripts
import tensorflow as tf
Expand All @@ -36,12 +36,12 @@
from path_planner.path_planner import path_planner

#Import dataset
pickledData = open(PICKLE_DIRECTORY+"listOfAllObj_v3.pkl","rb")
pickledData = open(RD_TRAINED_DATA_DIRECTORY+"listOfAllObj_v3.pkl","rb")
dataSet = pickle.load(pickledData)
pickledData.close()

#Import list of unqiue objects from training dataset
pickledObjs = open(PICKLE_DIRECTORY+"uniqueObjs_v3.pkl","rb")
pickledObjs = open(RD_TRAINED_DATA_DIRECTORY+"uniqueObjs_v3.pkl","rb")
uniqueObjs = pickle.load(pickledObjs)
uniqueObjs = dataSet.columns[0:-1]
pickledObjs.close()
Expand Down Expand Up @@ -121,10 +121,6 @@
########
# PATH PLANNING:
########
# confirm current room matches map (detectedRooms + currentPose + labeledMapFile)
# update local path
# if path end has been reached, throw err msg

#Load in pre-recorded map
currentMap = grab_map()

Expand Down
10 changes: 3 additions & 7 deletions semantic_mapping_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# SETUP:
########
#Directories with model weights and datasets
NN1_OD_DIRECTORY = '/weights/object_detector/' #Object detector
NN2_RD_DIRECTORY = '/weights/room_classifier/' #Room detector/guessor
NN_RD_DIRECTORY = '/weights/room_classifier/' #Room detector/guessor
TEST_DATASET = '/gdrive/My Drive/Colab Notebooks/SYSC 5906/datasets/mit_indoors/processed/data_labelsOnly/'
PICKLE_DIRECTORY = '/models/trained_data/data_labelsOnly/'
DETECTED_OBJS_DIRECTORY = '/dataset/detectedObjs'
Expand All @@ -41,11 +40,9 @@
from map_generation.map_generation import labelPath, roomLocalizer

#Load custom models
model_OD = tf.keras.models.load_model(NN1_OD_DIRECTORY)
model_RD = tf.keras.models.load_model(NN2_RD_DIRECTORY)

#Summarize models
model_OD.summary()
model_RD.summary()

####################################
Expand All @@ -58,7 +55,7 @@
########
OFFLINE = True
frames, path = cameraSetup(OFFLINE)

########
# MAIN LOOP:
########
Expand All @@ -67,7 +64,7 @@
# OBJECT DETECTION:
########
#Detect objects in current frame
objectDetector(currentFrame, model_OD)
objectDetector(frames, DETECTED_OBJS_DIRECTORY)

#Get detected objects from PKL file
pickledObjs = open(DETECTED_OBJS_DIRECTORY+"detectedObjs.pkl","rb")
Expand All @@ -94,4 +91,3 @@

#Save rooms as data??


4 changes: 2 additions & 2 deletions support_scripts/offline_support.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
def openImages():
image_list = []
for file in glob.glob('dataset/iamges/*.jpg'):
for file in glob.glob('/dataset/images/*.jpg'):
image = Image.open(file)
image_list.appen(image)
return image_list

def openPath():
posesDF = pd.read_csv('dataset/iamges/*.csv')
posesDF = pd.read_csv('/dataset/poses/*.csv')
print(df.head())
return posesDF

0 comments on commit cf34b73

Please sign in to comment.