Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Apply tf_upgrade_v2 for output_template #916

Merged
merged 3 commits into from
Mar 16, 2020

Conversation

ytfksw
Copy link
Contributor

@ytfksw ytfksw commented Mar 12, 2020

What this patch does to fix the issue.

I have realized that output_template has a python file using TensorFlow (output_template/python/lmnet/tensorflow_graph_runner.py)

This patch makes output_template/python/lmnet/tensorflow_graph_runner.py compatible with tf2

Here's what I did:

  1. install newest tenosrflow (tensorflow-gpu==1.5.2)
  2. Run the upgrade script tf_upgrade_v2 for output_template
  3. Check the upgrade report for warnings and errors
  4. Run test (make test)

Link to any relevant issues or pull requests.

@blueoil-butler blueoil-butler bot added the CI: auto-run Run CI automatically label Mar 12, 2020
@ytfksw ytfksw changed the title Apply tf_upgrade_v2 Apply tf_upgrade_v2 for output_template Mar 12, 2020
@ytfksw
Copy link
Contributor Author

ytfksw commented Mar 12, 2020

This is the whole convert log:

TensorFlow 2.0 Upgrade Script
-----------------------------
Converted 9 files
Detected 2 issues that require attention
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
File: output_template/python/run.py
--------------------------------------------------------------------------------
output_template/python/run.py:68:8: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------
File: output_template/python/motion_jpeg_server_from_camera.py
--------------------------------------------------------------------------------
output_template/python/motion_jpeg_server_from_camera.py:105:20: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
================================================================================
Detailed log follows:

================================================================================
================================================================================
Input tree: 'output_template'
================================================================================
--------------------------------------------------------------------------------
Processing file 'output_template/python/config.py'
 outputting to 'output_template/python/config.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/run.py'
 outputting to 'output_template/python/run.py'
--------------------------------------------------------------------------------

68:8: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/usb_camera_demo.py'
 outputting to 'output_template/python/usb_camera_demo.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/motion_jpeg_server_from_camera.py'
 outputting to 'output_template/python/motion_jpeg_server_from_camera.py'
--------------------------------------------------------------------------------

105:20: WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.
--------------------------------------------------------------------------------

Skipping symlink output_template/python/lmnet/nnlib.py.
--------------------------------------------------------------------------------
Processing file 'output_template/python/lmnet/tensorflow_graph_runner.py'
 outputting to 'output_template/python/lmnet/tensorflow_graph_runner.py'
--------------------------------------------------------------------------------

40:28: INFO: Renamed 'tf.GraphDef' to 'tf.compat.v1.GraphDef'
43:22: INFO: Renamed 'tf.global_variables_initializer' to 'tf.compat.v1.global_variables_initializer'
47:25: INFO: Renamed 'tf.ConfigProto' to 'tf.compat.v1.ConfigProto'
49:20: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/lmnet/__init__.py'
 outputting to 'output_template/python/lmnet/__init__.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/lmnet/utils/__init__.py'
 outputting to 'output_template/python/lmnet/utils/__init__.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'output_template/python/lmnet/utils/demo.py'
 outputting to 'output_template/python/lmnet/utils/demo.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

Skipping symlink output_template/python/blueoil/post_processor.py.
Skipping symlink output_template/python/blueoil/visualize.py.
Skipping symlink output_template/python/blueoil/pre_processor.py.
Skipping symlink output_template/python/blueoil/__init__.py.
Skipping symlink output_template/python/blueoil/data_augmentor.py.
Skipping symlink output_template/python/blueoil/common.py.
Skipping symlink output_template/python/blueoil/environment.py.
--------------------------------------------------------------------------------
Processing file 'output_template/python/blueoil/data_processor.py'
 outputting to 'output_template/python/blueoil/data_processor.py'
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------


@ytfksw
Copy link
Contributor Author

ytfksw commented Mar 13, 2020

We got 2 warnings about keras.model.save

WARNING: *.save requires manual check. (This warning is only applicable if the code saves a tf.Keras model) Keras model.save now saves to the Tensorflow SavedModel format by default, instead of HDF5. To continue saving to HDF5, add the argument save_format='h5' to the save() function.

Since we don't use Keras.model now, it is irrelevant.

Actually, we call PIL.Image.Image.save:
output_template/python/run.py:68:8: (PIL.Image.Image.save)
https://github.com/ytfksw/blueoil/blob/convert_tf2_utils/output_template/python/run.py#L68
output_template/python/motion_jpeg_server_from_camera.py:105:20: (PIL.Image.Image.save)
https://github.com/ytfksw/blueoil/blob/09b4c9f6a605266a4a8cb3af2d80062337ba91ae/output_template/python/motion_jpeg_server_from_camera.py#L105

@ytfksw ytfksw marked this pull request as ready for review March 13, 2020 08:26
@bo-code-review-bot
Copy link

This PR needs Approvals as follows.

  • Ownership Approval for / from iizukak, tkng, ruimashita
  • Readability Approval for Python from tkng, tsawada

Please choose reviewers and requet reviews!

Click to see how to approve each reviews

You can approve this PR by triggered comments as follows.

  • Approve all reviews requested to you (readability and ownership) and LGTM review
    Approval, LGTM

  • Approve all ownership reviews
    Ownership Approval or OA

  • Approve all readability reviews
    Readability Approval or RA

  • Approve specified review targets

    • Example of Ownership Reviewer of /: Ownership Approval for / or OA for /
    • Example of Readability Reviewer of Python: Readability Approval for Python or RA for Python
  • Approve LGTM review
    LGTM

See all trigger comments

Please replace [Target] to review target

  • Ownership Approval
    • Ownership Approval for [Target]
    • OA for [Target]
    • Ownership Approval
    • OA
    • Approval
  • Readability Approval
    • Readability Approval for [Target]
    • RA for [Target]
    • [Target] Readability Approval
    • [Target] RA
    • Readability Approval
    • RA
    • Approval
  • LGTM
    • LGTM
    • lgtm

Copy link
Member

@iizukak iizukak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OA

@iizukak iizukak requested a review from tsawada March 16, 2020 00:00
Copy link
Contributor

@tsawada tsawada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability Approval

@iizukak
Copy link
Member

iizukak commented Mar 16, 2020

/ready

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Mar 16, 2020

⏳Merge job is queued...

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Mar 16, 2020

😥Status check failed. Please fix problems and send /ready again.

@tfujiwar
Copy link
Contributor

/ready

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Mar 16, 2020

⏳Merge job is queued...

@bo-mergebot bo-mergebot bot merged commit 68463c2 into blue-oil:master Mar 16, 2020
@ytfksw ytfksw self-assigned this Jun 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI: auto-run Run CI automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants