-
Notifications
You must be signed in to change notification settings - Fork 690
[Model] add tracking trail on vis_mot #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: ChaoII <849453582@qq.com>
Signed-off-by: ChaoII <849453582@qq.com>
Signed-off-by: ChaoII <849453582@qq.com>
Signed-off-by: ChaoII <849453582@qq.com>
| def vis_mot(im_data, mot_result, score_threshold=0.0, is_draw_trail=False, trails: dict = None): | ||
| if is_draw_trail: | ||
| if trails is None: | ||
| print("[WARNING] <trails> must be a global dict, when <is_draw_trail> is True ,trails will be hidden!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改用logging.warn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经去掉python中不必要的逻辑
| cv::waitKey(30); | ||
| frame_id++; | ||
| } | ||
| capture.release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在for循环后,显式调用一行model.UnBindRecorder(); 便于用户直接了解
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添加显示调用
| cv2.waitKey(30) | ||
| if cv2.waitKey(30) == ord("q"): | ||
| break | ||
| cap.release() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也显式调用一行model.unbind_trail_recorder()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添加显示调用
| class FASTDEPLOY_DECL PPTracking: public FastDeployModel { | ||
| inline void TrailRecorder::Add(int id, const | ||
| std::vector<std::array<int, 2>> &record) { | ||
| records[id] = record; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里逻辑跟之前的不同
之前是遍历每个boxes,然后同时从map中查找到id,往id对应的vec push数据,现在是直接赋值,是一样的吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整逻辑,与起初沟通逻辑一致
| void BindRecorder(TrailRecorder* recorder); | ||
| /** \brief cancel binding and clear trail information | ||
| */ | ||
| void UnBindRecorder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unbind是一个单词,驼峰时给单词首字母大写即可,这里改成UnbindRecorder()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整变量命名
| from .... import c_lib_wrap as C | ||
|
|
||
|
|
||
| class TrailRecorder(C.vision.tracking.TrailRecorder): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要使用这种继承的方式,这样会导致FastDeploy在编译时,如果没有ENABLE_VISION的情况下,在import fastdeploy时,会提示找不到C.vision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已移除
| from __future__ import absolute_import | ||
| from .... import FastDeployModel, ModelFormat | ||
| from .... import c_lib_wrap as C | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以改成
try:
TrailRecorder = C.TrailRecorder
except:
pass
这样在python层面可以直接用fastdeploy.vision.tracking.TrailRecorder 无需再创建一个类
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已按要求调整
| TrailRecorder = C.vision.tracking.TrailRecorder | ||
| except Exception as e: | ||
| logging.warning("something was wrong, detail:" + str(e) + | ||
| "so 'TrailRecorder' can not be loaded") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行提示不用打出来,就单纯pass即可,否则在没有ENABLE_VISION的时候,import fastdeploy会打出来上面这行提示
|
有个代码冲突需解决下 |
PR types(PR类型)
Model
Describe
效果如下: