This commit is contained in:
pangkaicheng
2024-03-28 10:44:58 +08:00
parent 8d34a4ed7f
commit 4e832bbadb
2 changed files with 19 additions and 40 deletions

View File

@@ -379,7 +379,6 @@ class OutfitMaterTypeAware(OutfitMatcher):
Returns:
scores: List of float
"""
<<<<<<< HEAD
outfit_images, outfit_categories = self.preprocess(outfits, features)
scores = []
for images, categories in zip(outfit_images, outfit_categories):
@@ -400,28 +399,3 @@ class OutfitMaterTypeAware(OutfitMatcher):
scores = np.stack(scores, axis=0)
return scores.flatten()
=======
image, category, mask = self.preprocess(outfits)
client = httpclient.InferenceServerClient(url=f"{OM_TRITON_IP}:{OM_TRITON_PORT}")
# 输入集
inputs = [
httpclient.InferInput("input__0", image.shape, datatype="FP32"),
httpclient.InferInput("input__1", category.shape, datatype="INT16"),
httpclient.InferInput("input__2", mask.shape, datatype="FP32"),
]
inputs[0].set_data_from_numpy(image.astype(np.float32), binary_data=True)
inputs[1].set_data_from_numpy(category.astype(np.int16), binary_data=True)
inputs[2].set_data_from_numpy(mask.astype(np.float32), binary_data=True)
# 输出集
outputs = [
httpclient.InferRequestedOutput("output__0", binary_data=True),
httpclient.InferRequestedOutput("output__1", binary_data=True)
]
results = client.infer(model_name="outfit_matcher_type_aware", inputs=inputs, outputs=outputs)
# 推理
# 取结果
scores = torch.from_numpy(results.as_numpy("output__0")) # Shape (N, 1)
features = torch.from_numpy(results.as_numpy("output__1")) # Shape (N, 64)
return scores, features
>>>>>>> 1f23781b16e59bfbcbbb4d252e6a61685267e6c7