Browse Source

[to #42322933]ocr_detection pipeline jupyter环境bug fix

ocr_detection pipeline jupyter环境优化
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9876662
master
xixing.tj yingda.chen 3 years ago
parent
commit
7da07a8370
2 changed files with 6 additions and 1 deletions
  1. +5
    -0
      modelscope/pipelines/cv/ocr_detection_pipeline.py
  2. +1
    -1
      modelscope/pipelines/cv/ocr_utils/ops.py

+ 5
- 0
modelscope/pipelines/cv/ocr_detection_pipeline.py View File

@@ -17,6 +17,11 @@ from .ocr_utils import (SegLinkDetector, cal_width, combine_segments_python,
decode_segments_links_python, nms_python,
rboxes_to_polygons)

if tf.__version__ >= '2.0':
import tf_slim as slim
else:
from tensorflow.contrib import slim

if tf.__version__ >= '2.0':
tf = tf.compat.v1
tf.compat.v1.disable_eager_execution()


+ 1
- 1
modelscope/pipelines/cv/ocr_utils/ops.py View File

@@ -88,7 +88,7 @@ def _nn_variable(name, shape, init_method, collection=None, **kwargs):
else:
raise 'Unsupported weight initialization method: ' + init_method

var = tf.get_variable(name, shape=shape, initializer=initializer, **kwargs)
var = tf.get_variable(name, shape=shape, initializer=initializer)
if collection is not None:
tf.add_to_collection(collection, var)



Loading…
Cancel
Save