Fix undefined ‘im_array’ bug in predict.md (#8565)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: fang_chenfang <1217690899@qq.com>
This commit is contained in:
Glenn Jocher 2024-03-01 00:53:17 +01:00 committed by GitHub
parent aa592efda5
commit 6bdf8dfaa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 23 additions and 23 deletions

View file

@ -72,7 +72,7 @@ class AutoBackend(nn.Module):
| TensorFlow Lite | *.tflite |
| TensorFlow Edge TPU | *_edgetpu.tflite |
| PaddlePaddle | *_paddle_model |
| ncnn | *_ncnn_model |
| NCNN | *_ncnn_model |
This class offers dynamic backend switching capabilities based on the input model format, making it easier to deploy
models across various platforms.
@ -304,9 +304,9 @@ class AutoBackend(nn.Module):
input_handle = predictor.get_input_handle(predictor.get_input_names()[0])
output_names = predictor.get_output_names()
metadata = w.parents[1] / "metadata.yaml"
elif ncnn: # ncnn
LOGGER.info(f"Loading {w} for ncnn inference...")
check_requirements("git+https://github.com/Tencent/ncnn.git" if ARM64 else "ncnn") # requires ncnn
elif ncnn: # NCNN
LOGGER.info(f"Loading {w} for NCNN inference...")
check_requirements("git+https://github.com/Tencent/ncnn.git" if ARM64 else "ncnn") # requires NCNN
import ncnn as pyncnn
net = pyncnn.Net()
@ -431,7 +431,7 @@ class AutoBackend(nn.Module):
self.input_handle.copy_from_cpu(im)
self.predictor.run()
y = [self.predictor.get_output_handle(x).copy_to_cpu() for x in self.output_names]
elif self.ncnn: # ncnn
elif self.ncnn: # NCNN
mat_in = self.pyncnn.Mat(im[0].cpu().numpy())
ex = self.net.create_extractor()
input_names, output_names = self.net.input_names(), self.net.output_names()