diff --git a/Qwen_agent.py b/Qwen_agent.py index 8d57792..9fa5c07 100644 --- a/Qwen_agent.py +++ b/Qwen_agent.py @@ -122,6 +122,16 @@ def get_product_description(std_img, track_imgs): return contrast_pair +def item_analysis(stream_dict): + track_imgs = stream_pipeline(stream_dict) + std_img = None + if stream_dict['goodsPic'] is not None: + response = requests.get(stream_dict['goodsPic']) + std_img = Image.open(BytesIO(response.content)) + description_dict = get_product_description(std_img, track_imgs) + + return description_dict + def main(): # sample input dict stream_dict = { @@ -137,13 +147,8 @@ def main(): "goodsSpec" : "405g" } - track_imgs = stream_pipeline(stream_dict) - std_img = None - if stream_dict['goodsPic'] is not None: - response = requests.get(stream_dict['goodsPic']) - std_img = Image.open(BytesIO(response.content)) - description_dict = get_product_description(std_img, track_imgs) - print(description_dict) + result = item_analysis(stream_dict) + print(result) if __name__ == "__main__": main() \ No newline at end of file diff --git a/contrast/feat_extract/inference.py b/contrast/feat_extract/inference.py index 70ff84a..6fb12f1 100644 --- a/contrast/feat_extract/inference.py +++ b/contrast/feat_extract/inference.py @@ -108,7 +108,7 @@ class FeatsInterface: # patch = patch.to(device=self.device).half() if str(self.device) != "cpu": - patch = patch.to(device=self.device).half() + patch = patch.to(device=self.device) else: patch = patch.to(device=self.device) diff --git a/track_reid.py b/track_reid.py index 3687ded..bd6f884 100644 --- a/track_reid.py +++ b/track_reid.py @@ -217,7 +217,7 @@ def yolo_resnet_tracker( # Rescale boxes from img_size to im0 size det[:, :4] = scale_boxes(im.shape[2:], det[:, :4], im0.shape).round() - # det = det.cpu().numpy() + det = det.cpu().numpy() ## ================================================================ writed by WQG '''tracks: [x1, y1, x2, y2, track_id, score, cls, frame_index, box_index] 0 1 2 3 4 5 6 7 8 diff --git a/tracking/dotrack/dotracks_back.py b/tracking/dotrack/dotracks_back.py index d5235f3..40dfbd6 100644 --- a/tracking/dotrack/dotracks_back.py +++ b/tracking/dotrack/dotracks_back.py @@ -153,8 +153,8 @@ class doBackTracks(doTracks): hand_ious = [] - hboxes = np.empty(shape=(0, 9), dtype = np.float) - gboxes = np.empty(shape=(0, 9), dtype = np.float) + hboxes = np.empty(shape=(0, 9), dtype = float) + gboxes = np.empty(shape=(0, 9), dtype = float) # start, end 为索引值,需要 start:(end+1)