Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(test): fix img_process_for_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Xiao authored Aug 2, 2019
1 parent 64e948d commit 8ca07a7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_onnx_image_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def img_process_for_test(dirname):
zipfile_ = zipfile.ZipFile(os.path.join(dirname, 'imgs/test.zip'), "r")
zipfile_ = zipfile.ZipFile(os.path.join(dirname, 'imgs/test.zip'))
all_bytes = [zipfile_.open(v).read() for v in zipfile_.namelist()]
test_img = []
for raw_bytes in all_bytes:
Expand All @@ -19,14 +19,16 @@ def img_process_for_test(dirname):
test_img.append(d)

test_img_all_preprocessor = []
for preprocessor in [BaseUnaryPreprocessor(doc_type=gnes_pb2.Document.IMAGE),
pipline_prep1 = PipelinePreprocessor()
pipline_prep1.component = lambda: [BaseUnaryPreprocessor(doc_type=gnes_pb2.Document.IMAGE),
ResizeChunkPreprocessor()]
for preprocessor in [pipline_prep1,
VanillaSlidingPreprocessor()]:
test_img_copy = copy.deepcopy(test_img)
for img in test_img_copy:
preprocessor.apply(img)
test_img_all_preprocessor.append([blob2array(chunk.blob)
for img in test_img_copy for chunk in img.chunks])
return test_img_all_preprocessor
for img in


class TestONNXImageEncoder(unittest.TestCase):
Expand Down

0 comments on commit 8ca07a7

Please sign in to comment.