MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / _get_test_image

Method _get_test_image

tests/test_export_caffe2.py:47–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45 c2_model(inputs)[0]["instances"]
46
47 def _get_test_image(self):
48 try:
49 file_name = DatasetCatalog.get("coco_2017_train")[0]["file_name"]
50 assert PathManager.exists(file_name)
51 except Exception:
52 self.skipTest("COCO dataset not available.")
53
54 with PathManager.open(file_name, "rb") as f:
55 buf = f.read()
56 img = cv2.imdecode(np.frombuffer(buf, dtype=np.uint8), cv2.IMREAD_COLOR)
57 assert img is not None, file_name
58 return torch.from_numpy(img.transpose(2, 0, 1))
59
60 def testMaskRCNN(self):
61 self._test_model("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")

Callers 1

_test_modelMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected