{"id":613,"date":"2024-02-08T08:00:29","date_gmt":"2024-02-08T00:00:29","guid":{"rendered":"https:\/\/www.zhoubin.asia\/?p=613"},"modified":"2024-02-07T12:11:13","modified_gmt":"2024-02-07T04:11:13","slug":"hailo-model-zoo","status":"publish","type":"post","link":"https:\/\/www.zhoubin.asia\/index.php\/2024\/02\/08\/hailo-model-zoo\/","title":{"rendered":"[Hailo Model Zoo]\u5982\u4f55\u5229\u7528Hailo Model Zoo \u521b\u5efa\u72ec\u7acb\u8fd0\u884c\u7684\u5176\u4ed6\u6a21\u578b\u811a\u672c"},"content":{"rendered":"<h1>\u5982\u4f55\u4f7f\u7528 Hailo Model Zoo \u521b\u5efa\u72ec\u7acb\u8fd0\u884c\u7684\u5176\u4ed6\u6a21\u578b<\/h1>\n<h2>1. \u4ecb\u7ecd<\/h2>\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Hailo Model Zoo \u793a\u4f8b\u521b\u5efa\u72ec\u7acb\u7248\u672c\u7684\u6a21\u578b\u3002<\/p>\n<h2>2. \u6b65\u9aa4<\/h2>\n<h3>\u9996\u5148\uff1a<\/h3>\n<p>\u672c\u8fc7\u7a0b\u57fa\u4e8e\u6211\u4eec\u7684 Hailo Model Zoo, \u6240\u4ee5\u4f60\u7684\u6a21\u578b\u5fc5\u987b\u662f\u6211\u4eecHailo Model Zoo \u652f\u6301\u7684\u6a21\u578b\uff0c \u548c\u5b9e\u4f8b\u5206\u5272\u7684sample code\u3002\u5e76\u4e14\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e Python \u7248\u672c\u3002<\/p>\n<h3>\u5176\u6b21\uff1a<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 `hailomz eval` \u6765\u68c0\u67e5\u4f60\u5e0c\u671b\u652f\u6301\u7684\u6a21\u578b\u8f93\u51fa\u6548\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002\u4f8b\u5982\uff08\u4ee5yolov8s_pose\u4e3a\u4f8b\uff09\uff1a<\/p>\n<p><code>hailomz eval yolov8s_pose --target hailo8 --hef yolov8s_pose.hef --data-path test_pose --visualize<\/code><\/p>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165 `hailomz eval &#8211;help` \u67e5\u770b\u66f4\u591a\u4f7f\u7528\u8bf4\u660e\u3002<\/p>\n<h3>\u7b2c\u4e09\uff1a<\/h3>\n<p>\u7531\u4e8e\u4e0d\u540c\u7684\u6a21\u578b\u8bc4\u4f30\u5177\u6709\u4e0d\u540c\u7684\u540e\u5904\u7406\u529f\u80fd\u548c\u5173\u952e\u5b57\u53c2\u6570\uff0c\u60a8\u9700\u8981\u4e86\u89e3\u76ee\u6807\u6a21\u578b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u5728\u6587\u4ef6 `hailo_model_zoo\/core\/postprocessing\/postprocessing_factory.py` \u4e2d\u6253\u5370\u6240\u6709\u5173\u952e\u5b57\u53c2\u6570\uff1a<\/p>\n<pre>def print_kwargs(**kwargs):\r\n    for key, value in kwargs.items():\r\n        print(f\"{key}: {value}\")\r\n\r\ndef postprocessing_fn(endnodes, device_pre_post_layers=None, **kwargs):\r\n    <em>print_kwargs(**kwargs)<\/em>\r\n    return postprocessing_fn_map[name](endnodes, device_pre_post_layers, **kwargs)\r\n<\/pre>\n<p>\u6b64\u5c06\u6253\u5370\u6240\u6709\u5173\u952e\u5b57\u53c2\u6570\uff0c\u60a8\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u53c2\u6570\u6765\u8bbe\u7f6e\u60a8\u81ea\u5df1\u7684\u76ee\u6807\u5173\u952e\u5b57\u53c2\u6570\u3002<\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7 `postprocessing_fn_map` \u548c `visualization_fn_map` \u627e\u5230\u60a8\u7684\u540e\u5904\u7406\u548c\u53ef\u89c6\u5316\u51fd\u6570\uff0c\u4ee5\u5e2e\u52a9\u5b9a\u4f4d\u60a8\u7684\u540e\u5904\u7406\u6587\u4ef6\u3002<br \/>\n\u4f8b\u5982\uff1a<\/p>\n<pre>from hailo_model_zoo.core.postprocessing.pose_estimation_postprocessing \r\n     import (pose_estimation_postprocessing, visualize_pose_estimation_result)\r\n<\/pre>\n<h3>\u7b2c\u56db\uff1a<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e0e\u5b9e\u4f8b\u5206\u5272\u7c7b\u4f3c\u7684\u65b9\u6cd5\u521b\u5efa\u81ea\u5df1\u7248\u672c\u7684\u540e\u5904\u7406\u3002\u5982\u679c\u5b83\u4f9d\u8d56\u4e8e\u4e00\u4e9bhailo model zoo\u7684\u51fd\u6570\uff0c\u53ea\u9700\u5c06\u5176\u590d\u5236\u51fa\u6765\u5373\u53ef\u3002\u8bb0\u5f97\u9884\u5148\u8bbe\u7f6e\u4e0a\u4e00\u6b65\u83b7\u53d6\u7684\u5173\u952e\u5b57\u53c2\u6570\u503c\u3002<br \/>\n\u4f8b\u5982(yolov8_pose)\uff1a<\/p>\n<pre>arch_dict = {'v8': {'anchors':\r\n                 {'scale_factors': [0.5, 0.5],\r\n                  'sizes': [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]],\r\n                  'type': 'default',\r\n                  'strides': [8, 16, 32],\r\n                  'regression_length': 15}\r\n                 }\r\n            }\r\narch_list = arch_dict.keys()\r\nnum_of_classes = args.class_num\r\nkwargs['meta_arch'] = 'nanodet_v8'\r\nanchors = arch_dict['v8']\r\nkwargs['anchors'] = arch_dict['v8']['anchors']\r\nkwargs['score_threshold'] = 0.001\r\nkwargs['nms_iou_thresh'] = 0.7\r\nkwargs['dataset_name'] = 'cocopose'\r\nkwargs['nms_max_output_per_class'] = 300\r\n\r\ndef postproc_yolov8pose(raw_detections):\r\n    raw_detections_keys = list(raw_detections.keys())\r\n    layer_from_shape: dict = {raw_detections[key].shape:key for key in raw_detections_keys}\r\n    pose_channels = 51\r\n    detection_output_channels = (kwargs['anchors']['regression_length'] + 1) * 4 # (regression length + 1) * num_coordinates\r\n    endnodes = [raw_detections[layer_from_shape[1, 20, 20, detection_output_channels]],\r\n                raw_detections[layer_from_shape[1, 20, 20, kwargs['classes']]],\r\n                raw_detections[layer_from_shape[1, 20, 20, pose_channels]],\r\n                raw_detections[layer_from_shape[1, 40, 40, detection_output_channels]],\r\n                raw_detections[layer_from_shape[1, 40, 40, kwargs['classes']]],\r\n                raw_detections[layer_from_shape[1, 40, 40, pose_channels]],\r\n                raw_detections[layer_from_shape[1, 80, 80, detection_output_channels]],\r\n                raw_detections[layer_from_shape[1, 80, 80, kwargs['classes']]],\r\n                raw_detections[layer_from_shape[1, 80, 80, pose_channels]]]\r\n    predictions_dict = pose_estimation_postprocessing(endnodes, **kwargs)\r\n    return predictions_dict\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 Hailo Model Zoo \u521b\u5efa\u72ec\u7acb\u8fd0\u884c\u7684\u5176\u4ed6\u6a21\u578b 1. \u4ecb\u7ecd \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Hailo  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[18,1],"tags":[],"class_list":["post-613","post","type-post","status-publish","format-standard","hentry","category-hailo-model-zoo","category-tech"],"_links":{"self":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/comments?post=613"}],"version-history":[{"count":2,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/613\/revisions"}],"predecessor-version":[{"id":615,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/613\/revisions\/615"}],"wp:attachment":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/media?parent=613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/categories?post=613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/tags?post=613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}