MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / DetectionFile2Image

Class DetectionFile2Image

python/paddle_serving_app/reader/image_reader.py:606–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604 return self.__class__.__name__ + "()"
605
606class DetectionFile2Image(object):
607 def __init__(self):
608 pass
609
610 def __call__(self, img_path, im_info=None):
611 if py_version == 2:
612 fin = open(img_path)
613 else:
614 fin = open(img_path, "rb")
615 sample = fin.read()
616 data = np.fromstring(sample, np.uint8)
617 img = cv2.imdecode(data, cv2.IMREAD_COLOR)
618 img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
619 '''
620 img = cv2.imread(img_path, -1)
621 channels = img.shape[2]
622 ori_h = img.shape[0]
623 ori_w = img.shape[1]
624 '''
625 if im_info is not None:
626 im_info['im_shape'] = np.array(img.shape[:2], dtype=np.float32)
627 im_info['scale_factor'] = np.array([1., 1.], dtype=np.float32)
628 return img, im_info
629
630 def __repr__(self):
631 return self.__class__.__name__ + "()"
632
633
634class URL2Image(object):

Callers 8

test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85
test_client.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected