Skip to content

Conversation

@ChaoII
Copy link
Collaborator

@ChaoII ChaoII commented Oct 31, 2022

PR types(PR类型)

Model

Describe

  • 添加多目标跟踪可视化轨迹的显示
    效果如下:

image

ChaoII and others added 30 commits September 30, 2022 16:08
Signed-off-by: ChaoII <849453582@qq.com>
Signed-off-by: ChaoII <849453582@qq.com>
@ChaoII ChaoII marked this pull request as draft October 31, 2022 02:51
@ChaoII ChaoII marked this pull request as ready for review November 1, 2022 09:05
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!")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改用logging.warn

Copy link
Collaborator Author

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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在for循环后,显式调用一行model.UnBindRecorder(); 便于用户直接了解

Copy link
Collaborator Author

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也显式调用一行model.unbind_trail_recorder()

Copy link
Collaborator Author

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;
Copy link
Collaborator

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数据,现在是直接赋值,是一样的吗?

Copy link
Collaborator Author

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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unbind是一个单词,驼峰时给单词首字母大写即可,这里改成UnbindRecorder()

Copy link
Collaborator Author

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):
Copy link
Collaborator

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

Copy link
Collaborator Author

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

Copy link
Collaborator

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 无需再创建一个类

Copy link
Collaborator Author

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")
Copy link
Collaborator

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会打出来上面这行提示

@jiangjiajun
Copy link
Collaborator

有个代码冲突需解决下

@jiangjiajun jiangjiajun merged commit 22d60fd into PaddlePaddle:develop Nov 3, 2022
@ChaoII ChaoII deleted the pptracking branch November 3, 2022 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants