"docs/en/git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "75ea2f89954a0edc0eef620b28e077e1aefa9c01"
Commit 0d7ce10e authored by Andre Araujo's avatar Andre Araujo
Browse files

Fix file reading issue for python3 code

parent 72699325
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Python interface for DatumProto. """Python interface for DatumProto.
DatumProto is protocol buffer used to serialize tensor with arbitrary shape. DatumProto is protocol buffer used to serialize tensor with arbitrary shape.
...@@ -93,7 +92,7 @@ def ReadFromFile(file_path): ...@@ -93,7 +92,7 @@ def ReadFromFile(file_path):
Returns: Returns:
data: Numpy array. data: Numpy array.
""" """
with tf.gfile.FastGFile(file_path, 'r') as f: with tf.gfile.FastGFile(file_path, 'rb') as f:
return ParseFromString(f.read()) return ParseFromString(f.read())
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Python interface for DelfFeatures proto. """Python interface for DelfFeatures proto.
Support read and write of DelfFeatures from/to numpy arrays and file. Support read and write of DelfFeatures from/to numpy arrays and file.
...@@ -168,7 +167,7 @@ def ReadFromFile(file_path): ...@@ -168,7 +167,7 @@ def ReadFromFile(file_path):
attention: [N] float array with attention scores. attention: [N] float array with attention scores.
orientations: [N] float array with orientations. orientations: [N] float array with orientations.
""" """
with tf.gfile.FastGFile(file_path, 'r') as f: with tf.gfile.FastGFile(file_path, 'rb') as f:
return ParseFromString(f.read()) return ParseFromString(f.read())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment