MCPcopy
hub / github.com/jkjung-avt/tensorrt_demos / detect

Method detect

utils/ssd.py:103–125  ·  view source on GitHub ↗

Detect objects in the input image.

(self, img, conf_th=0.3)

Source from the content-addressed store, hash-verified

101 del self.stream
102
103 def detect(self, img, conf_th=0.3):
104 """Detect objects in the input image."""
105 img_resized = _preprocess_trt(img, self.input_shape)
106 np.copyto(self.host_inputs[0], img_resized.ravel())
107
108 if self.cuda_ctx:
109 self.cuda_ctx.push()
110 cuda.memcpy_htod_async(
111 self.cuda_inputs[0], self.host_inputs[0], self.stream)
112 self.context.execute_async(
113 batch_size=1,
114 bindings=self.bindings,
115 stream_handle=self.stream.handle)
116 cuda.memcpy_dtoh_async(
117 self.host_outputs[1], self.cuda_outputs[1], self.stream)
118 cuda.memcpy_dtoh_async(
119 self.host_outputs[0], self.cuda_outputs[0], self.stream)
120 self.stream.synchronize()
121 if self.cuda_ctx:
122 self.cuda_ctx.pop()
123
124 output = self.host_outputs[0]
125 return _postprocess_trt(img, output, conf_th)

Callers 8

loop_and_detectFunction · 0.45
loop_and_detectFunction · 0.45
runMethod · 0.45
loop_and_detectFunction · 0.45
generate_resultsFunction · 0.45
loop_and_detectFunction · 0.45
loop_and_detectFunction · 0.45
generate_resultsFunction · 0.45

Calls 2

_preprocess_trtFunction · 0.85
_postprocess_trtFunction · 0.85

Tested by

no test coverage detected