Skip to content

Conversation

@Raghav4138
Copy link

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"

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()
----------------------------------------------------------------------------
    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()
----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant