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

tf_upgrade_v2 for configs #899

Merged
merged 2 commits into from
Mar 11, 2020
Merged

Conversation

ytfksw
Copy link
Contributor

@ytfksw ytfksw commented Mar 6, 2020

What this patch does to fix the issue.

I converted only the blueoil/configs with the command line tool tf_upgrade_v2 to run on tensorflow2.

Since the template of the config in blueoil/templates cannot be changed by the script,
first I convert the sample configuration file in the configs folder.

Here's what I did:

  1. install newest tenosrflow (tensorflow-gpu==1.5.2)
  2. Run the upgrade script tf_upgrade_v2
  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 6, 2020
@ytfksw
Copy link
Contributor Author

ytfksw commented Mar 6, 2020

This is the whole convert log:

TensorFlow 2.0 Upgrade Script
-----------------------------
Converted 30 files
Detected 0 issues that require attention
--------------------------------------------------------------------------------
================================================================================
Detailed log follows:

================================================================================
================================================================================
Input tree: 'configs'
================================================================================
--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lm_resnet_quantize_cifar10.py'
 outputting to 'configs/core/classification/lm_resnet_quantize_cifar10.py'
--------------------------------------------------------------------------------

79:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
81:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_v1_quantize_cifar10_tune.py'
 outputting to 'configs/core/classification/lmnet_v1_quantize_cifar10_tune.py'
--------------------------------------------------------------------------------

89:29: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
98:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_quantize_cifar100.py'
 outputting to 'configs/core/classification/lmnet_quantize_cifar100.py'
--------------------------------------------------------------------------------

75:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
77:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_v1_quantize_cifar10.py'
 outputting to 'configs/core/classification/lmnet_v1_quantize_cifar10.py'
--------------------------------------------------------------------------------

75:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
77:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_cifar10.py'
 outputting to 'configs/core/classification/lmnet_cifar10.py'
--------------------------------------------------------------------------------

72:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
74:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_cifar100.py'
 outputting to 'configs/core/classification/lmnet_cifar100.py'
--------------------------------------------------------------------------------

72:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
74:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/resnet_cifar10.py'
 outputting to 'configs/core/classification/resnet_cifar10.py'
--------------------------------------------------------------------------------

73:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
75:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_quantize_cifar10.py'
 outputting to 'configs/core/classification/lmnet_quantize_cifar10.py'
--------------------------------------------------------------------------------

76:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
78:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/darknet_quantize_ilsvrc_2012.py'
 outputting to 'configs/core/classification/darknet_quantize_ilsvrc_2012.py'
--------------------------------------------------------------------------------

79:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
81:29: INFO: tf.train.polynomial_decay requires manual check. To use learning rate decay schedules with TensorFlow 2.0, switch to the schedules in `tf.keras.optimizers.schedules`.

81:29: INFO: Renamed 'tf.train.polynomial_decay' to 'tf.compat.v1.train.polynomial_decay'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_openimagesv4.py'
 outputting to 'configs/core/classification/lmnet_openimagesv4.py'
--------------------------------------------------------------------------------

71:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
73:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/lmnet_v1_cifar10.py'
 outputting to 'configs/core/classification/lmnet_v1_cifar10.py'
--------------------------------------------------------------------------------

71:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
73:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/darknet_cifar10.py'
 outputting to 'configs/core/classification/darknet_cifar10.py'
--------------------------------------------------------------------------------

72:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
74:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/mobilenet_v2_cifar10.py'
 outputting to 'configs/core/classification/mobilenet_v2_cifar10.py'
--------------------------------------------------------------------------------

72:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
74:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/classification/darknet_quantize_cifar10.py'
 outputting to 'configs/core/classification/darknet_quantize_cifar10.py'
--------------------------------------------------------------------------------

75:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
77:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/segnet_quantize_cityscapes.py'
 outputting to 'configs/core/segmentation/segnet_quantize_cityscapes.py'
--------------------------------------------------------------------------------

75:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/segnet_quantize_camvid.py'
 outputting to 'configs/core/segmentation/segnet_quantize_camvid.py'
--------------------------------------------------------------------------------

73:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/lm_segnet_v0_quantize_camvid.py'
 outputting to 'configs/core/segmentation/lm_segnet_v0_quantize_camvid.py'
--------------------------------------------------------------------------------

71:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/segnet_quantize_camvid_tune.py'
 outputting to 'configs/core/segmentation/segnet_quantize_camvid_tune.py'
--------------------------------------------------------------------------------

88:29: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
96:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/lm_bisenet_quantize_camvid.py'
 outputting to 'configs/core/segmentation/lm_bisenet_quantize_camvid.py'
--------------------------------------------------------------------------------

83:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/lm_segnet_v1_quantize_camvid.py'
 outputting to 'configs/core/segmentation/lm_segnet_v1_quantize_camvid.py'
--------------------------------------------------------------------------------

75:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/segnet_camvid.py'
 outputting to 'configs/core/segmentation/segnet_camvid.py'
--------------------------------------------------------------------------------

69:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/segmentation/segnet_quantize_bdd100k.py'
 outputting to 'configs/core/segmentation/segnet_quantize_bdd100k.py'
--------------------------------------------------------------------------------

69:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/object_detection/lm_fyolo_bdd100k.py'
 outputting to 'configs/core/object_detection/lm_fyolo_bdd100k.py'
--------------------------------------------------------------------------------

83:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
85:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/object_detection/yolo_v2_quantize_pascalvoc_2007_2012.py'
 outputting to 'configs/core/object_detection/yolo_v2_quantize_pascalvoc_2007_2012.py'
--------------------------------------------------------------------------------

190:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
192:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/object_detection/lm_fyolo_quantize_pascalvoc_2007_2012.py'
 outputting to 'configs/core/object_detection/lm_fyolo_quantize_pascalvoc_2007_2012.py'
--------------------------------------------------------------------------------

102:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
104:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/core/keypoint_detection/lm_single_pose_v1_quantize_mscoco.py'
 outputting to 'configs/core/keypoint_detection/lm_single_pose_v1_quantize_mscoco.py'
--------------------------------------------------------------------------------

88:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
90:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/example/object_detection.py'
 outputting to 'configs/example/object_detection.py'
--------------------------------------------------------------------------------

91:26: INFO: Renamed 'tf.train.MomentumOptimizer' to 'tf.compat.v1.train.MomentumOptimizer'
93:29: INFO: Renamed 'tf.train.piecewise_constant' to 'tf.compat.v1.train.piecewise_constant'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/example/classification.py'
 outputting to 'configs/example/classification.py'
--------------------------------------------------------------------------------

83:26: INFO: Renamed 'tf.train.AdamOptimizer' to 'tf.compat.v1.train.AdamOptimizer'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Processing file 'configs/convert_weight_from_darknet/yolo_v2.py'
 outputting to 'configs/convert_weight_from_darknet/yolo_v2.py'
--------------------------------------------------------------------------------


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

--------------------------------------------------------------------------------
Processing file 'configs/convert_weight_from_darknet/darknet19.py'
 outputting to 'configs/convert_weight_from_darknet/darknet19.py'
--------------------------------------------------------------------------------


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

@ytfksw
Copy link
Contributor Author

ytfksw commented Mar 6, 2020

From this PR, we know that the value of NETWORK.OPTIMIZER_CLASS、NETWORK.LEARNING_RATE_FUNC should be changed.

Also I have realized also that the blueoil/template files itself has no tensorflow function.
We have to change generate_lmnet_config.py instead of the blueoil/template.

https://github.com/blue-oil/blueoil/blob/master/blueoil/generate_lmnet_config.py#L159-L162

https://github.com/blue-oil/blueoil/blob/master/blueoil/generate_lmnet_config.py#L176-178

@ytfksw ytfksw force-pushed the convert_tf2_configs branch from 5e0351a to 90e7300 Compare March 6, 2020 05:10
@ytfksw ytfksw marked this pull request as ready for review March 6, 2020 10:51
@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.

Ownership Approval

@iizukak iizukak requested a review from tsawada March 10, 2020 13:20
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 10, 2020

/ready

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Mar 10, 2020

⏳Merge job is queued...

@bo-mergebot bo-mergebot bot merged commit a0078e1 into blue-oil:master Mar 11, 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.

3 participants