Modified some functions in C4W3 CarDetection file to make Tensorflow v2 compatible.#60
Open
Raghav4138 wants to merge 2 commits into
Open
Modified some functions in C4W3 CarDetection file to make Tensorflow v2 compatible.#60Raghav4138 wants to merge 2 commits into
Raghav4138 wants to merge 2 commits into
Conversation
TensorFlow version2.
The following file was modified.
".\coursera-deep-learning-specialization\C4 - Convolutional Neural Networks\Week 3\Car detection for Autonomous Driving\Autonomous_driving_application_Car_detection_v3a.ipynb"
DESCRIPTION:
General changes:
---------tf.function() -> tf.compat.v1.function()
----------------------------------------------------------------------------
In function yolo_filter_boxes()
K.argmax -> tf.argmax
K.reduce_max -> tf.reduce_max
----------------------------------------------------------------------------
In function iou()
used better names, to reduce code redundancy
----------------------------------------------------------------------------
In function yolo_non_max_suppression()
---------these 2 lines were changed
max_boxes_tensor = K.variable(max_boxes, dtype='int32') # tensor to be used in tf.image.non_max_suppression()
K.get_session().run(tf.variables_initializer([max_boxes_tensor])) # initialize variable max_boxes_tensor
---------new lines
max_boxes_tensor = tf.keras.backend.variable(max_boxes, dtype='int32') # tensor to be used in tf.image.non_max_suppression()
with tf.compat.v1.Session() as sess:
sess.run(tf.compat.v1.variables_initializer([max_boxes_tensor])) # initialize variable max_boxes_tensor
--------- K.gather() -> tf.gather()
----------------------------------------------------------------------------
TensorFlow version2.
The following file was modified.
".\coursera-deep-learning-specialization\C4 - Convolutional Neural Networks\Week 3\Car detection for Autonomous Driving\Autonomous_driving_application_Car_detection_v3a.ipynb"
DESCRIPTION:
General changes:
---------tf.function() -> tf.compat.v1.function()
----------------------------------------------------------------------------
In function yolo_filter_boxes()
K.argmax -> tf.argmax
K.reduce_max -> tf.reduce_max
----------------------------------------------------------------------------
In function iou()
used better names, to reduce code redundancy
----------------------------------------------------------------------------
In function yolo_non_max_suppression()
---------these 2 lines were changed
max_boxes_tensor = K.variable(max_boxes, dtype='int32') # tensor to be used in tf.image.non_max_suppression()
K.get_session().run(tf.variables_initializer([max_boxes_tensor])) # initialize variable max_boxes_tensor
---------new lines
max_boxes_tensor = tf.keras.backend.variable(max_boxes, dtype='int32') # tensor to be used in tf.image.non_max_suppression()
with tf.compat.v1.Session() as sess:
sess.run(tf.compat.v1.variables_initializer([max_boxes_tensor])) # initialize variable max_boxes_tensor
--------- K.gather() -> tf.gather()
----------------------------------------------------------------------------
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
modified some functions to be compatible with
TensorFlow version2.
The following file was modified.
".\coursera-deep-learning-specialization\C4 - Convolutional Neural Networks\Week 3\Car detection for Autonomous Driving\Autonomous_driving_application_Car_detection_v3a.ipynb"