Fix CoreML P6 inference (#6700)
* Fix CoreML P6 inference * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
3670d91b05
commit
56697c43ff
|
|
@ -428,7 +428,8 @@ class DetectMultiBackend(nn.Module):
|
||||||
conf, cls = y['confidence'].max(1), y['confidence'].argmax(1).astype(np.float)
|
conf, cls = y['confidence'].max(1), y['confidence'].argmax(1).astype(np.float)
|
||||||
y = np.concatenate((box, conf.reshape(-1, 1), cls.reshape(-1, 1)), 1)
|
y = np.concatenate((box, conf.reshape(-1, 1), cls.reshape(-1, 1)), 1)
|
||||||
else:
|
else:
|
||||||
y = y[sorted(y)[-1]] # last output
|
k = 'var_' + str(sorted(int(k.replace('var_', '')) for k in y)[-1]) # output key
|
||||||
|
y = y[k] # output
|
||||||
else: # TensorFlow (SavedModel, GraphDef, Lite, Edge TPU)
|
else: # TensorFlow (SavedModel, GraphDef, Lite, Edge TPU)
|
||||||
im = im.permute(0, 2, 3, 1).cpu().numpy() # torch BCHW to numpy BHWC shape(1,320,192,3)
|
im = im.permute(0, 2, 3, 1).cpu().numpy() # torch BCHW to numpy BHWC shape(1,320,192,3)
|
||||||
if self.saved_model: # SavedModel
|
if self.saved_model: # SavedModel
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue