Skip to content
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

[MOT] add MOT data #2789

Merged
merged 9 commits into from
May 11, 2021
Merged

[MOT] add MOT data #2789

merged 9 commits into from
May 11, 2021

Conversation

nemonameless
Copy link
Collaborator

No description provided.

ppdet/data/source/mot.py Outdated Show resolved Hide resolved
ppdet/data/transform/mot_operators.py Outdated Show resolved Hide resolved
'DecodeVideo', 'Resize_LetterBox', 'AugmentHSV', 'NormalizedBbox2PixelBbox',
'RandomAffine', 'BboxXYWH2XYXY',
'Gt2JDETargetThres', 'Gt2JDETargetMax',
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里面感觉DecodeVideo,AugmentHSV,NormalizedBbox2PixelBbox,RandomAffine,BboxXYWH2XYXY都属于通用的预处理操作?可以放到operators里?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里面感觉DecodeVideo,AugmentHSV,NormalizedBbox2PixelBbox,RandomAffine,BboxXYWH2XYXY都属于通用的预处理操作?可以放到operators里?

原本是放在operators.py里的,那只有'Gt2JDETargetThres', 'Gt2JDETargetMax'需要分出去到mot_operators.py吗?,还是也放在batch_operators.py ?

Copy link
Collaborator Author

@nemonameless nemonameless May 3, 2021

Choose a reason for hiding this comment

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

Done, mot_operators.py里只保留了'Resize_LetterBox', 'Gt2JDETargetThres', 'Gt2JDETargetMax'

ppdet/data/source/mot.py Outdated Show resolved Hide resolved
dataset/mot/README.md Outdated Show resolved Hide resolved
ppdet/data/reader.py Show resolved Hide resolved
ppdet/data/source/mot.py Outdated Show resolved Hide resolved
ppdet/data/transform/mot_operators.py Outdated Show resolved Hide resolved
ppdet/data/transform/operators.py Outdated Show resolved Hide resolved
ppdet/data/transform/operators.py Outdated Show resolved Hide resolved


@register_op
class Norm2PixelBbox(BaseOperator):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Norm2PixelBbox, BboxCXCYWH2XYXY能否去除?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

config里的EvalReader有用到,是eval检测结果时用到的

docs/tutorials/PrepareMOTDataSet.md Outdated Show resolved Hide resolved
dataset_dir (str): root directory for dataset.
image_dir (str): directory for images.
anno_path (str): annotation file path.
image_lists (str|list): mot data image lists, muiti-source mot dataset.
Copy link
Collaborator

Choose a reason for hiding this comment

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

给个示例更好,看着下面有‘image_lists’, ‘labels_with_ids’硬规则

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已加在注释中

ppdet/data/transform/mot_operators.py Outdated Show resolved Hide resolved


@register_mot_op
class Resize_LetterBox(BaseOperator):
Copy link
Collaborator

Choose a reason for hiding this comment

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

注意Python Code Style

Resize_LetterBox -> ResizeLetterBox

Letter这里是啥意思呢?

Copy link
Collaborator Author

@nemonameless nemonameless May 7, 2021

Choose a reason for hiding this comment

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

letterbox是resize的一种,保持图片的长宽比,剩下的部分填补灰色,以免暴力resize造成图片失真。ultralytics/yolov3#232

现有operators.py的4个OP各自稍微改动也可以组成letterbox的效果,但是不完全对齐,与其改动4个OP不如新加一个OP

super(DecodeVideo, self).__init__()

def apply(self, sample, context=None):
im = sample['image']
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的 sample['image']是个video吗?

Decode的含义是解码,VideoCapture才包含解码。下面cvtColor是解码之后的color space的变化。这里这个命名不适合。

另外,DecodeVideo这个函数有用吗?

Copy link
Collaborator Author

@nemonameless nemonameless May 7, 2021

Choose a reason for hiding this comment

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

sample['image']是图片,视频是在dataloader里解码为图片的,所以送入DecodeVideo的已经是numpy的图片。DecodeVideo在config的TestMOTReader里,制作demo时或者infer直接读视频去过模型得到结果, 因为读图片文件夹的话,时间长点的视频抽出来的图片数太多太多,也占空间。
已暂时去除。

img_index = 0
for data_name in self.image_lists:
with open(
os.path.join(dataset_dir, 'image_lists', data_name),
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的image_lists应该对应anno_path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个严格意义上不是anno,就只是个图片路径的list

yghstill
yghstill previously approved these changes May 10, 2021
Copy link
Collaborator

@yghstill yghstill left a comment

Choose a reason for hiding this comment

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

LGTM

qingqing01
qingqing01 previously approved these changes May 10, 2021
@nemonameless nemonameless dismissed stale reviews from qingqing01 and yghstill via 1cce13e May 10, 2021 09:02
!MOTDataSet
dataset_dir: dataset/mot
image_lists: ['citypersons.val', 'caltech.val'] # for detection
# image_lists: ['caltech.10k.val', 'cuhksysu.val', 'prw.val'] # for reid
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个在什么场景用到,如果有模型依赖这个的话,可以另加一个mot_reid.yml的数据集配置

Copy link
Collaborator Author

@nemonameless nemonameless May 10, 2021

Choose a reason for hiding this comment

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

这个在什么场景用到,如果有模型依赖这个的话,可以另加一个mot_reid.yml的数据集配置

eval 模型的指标可选择3种模式。eval检测使用['citypersons.val', 'caltech.val'],eval reid 使用['caltech.10k.val', 'cuhksysu.val', 'prw.val'],这两种是EvalDataset的配置(MOTDataSet),就和其他检测模型的流程一样。eval 跟踪的指标MOTA,具体eval哪个跟踪数据集由运行命令行参数控制,是EvalMOTDataset的配置(ImageFolder),每个视频序列是按图片文件夹形式去读取的。
eval检测或reid并不常用,个人觉得没有必要分出去再写一个

ppdet/data/transform/mot_operators.py Outdated Show resolved Hide resolved
""" Resize the image numpy.
"""
im = sample['image']
h, w = sample['im_shape']
Copy link
Collaborator

Choose a reason for hiding this comment

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

h, w = im.shape

ppdet/data/transform/mot_operators.py Show resolved Hide resolved
ppdet/data/transform/operators.py Outdated Show resolved Hide resolved
ppdet/data/transform/operators.py Show resolved Hide resolved
ppdet/data/transform/operators.py Outdated Show resolved Hide resolved
jerrywgz
jerrywgz previously approved these changes May 11, 2021
Copy link
Collaborator

@jerrywgz jerrywgz left a comment

Choose a reason for hiding this comment

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

LGTM

if isinstance(self.anno_path, list):
for path in self.anno_path:
self.dataset_dir = get_dataset_path(self.dataset_dir, path,
self.image_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里self.dataset_dir会被重写覆盖?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

不会覆盖,只是检查各个数据集目录是否存在。self.dataset_dir在configs/datasets/mot.yml里一般设置为dataset/mot

@nemonameless nemonameless merged commit 4575dfe into PaddlePaddle:develop May 11, 2021
@nemonameless nemonameless deleted the mot_data branch December 17, 2021 11:45
jerrywgz pushed a commit to jerrywgz/PaddleDetection that referenced this pull request Dec 5, 2022
* add mot data

* fix operators, source

* fix data source transform

* fix parse_dataset register_op

* fix scale_factor, RandomAffine

* add assert for check

* fix ci
jerrywgz pushed a commit to jerrywgz/PaddleDetection that referenced this pull request Dec 5, 2022
* add mot data

* fix operators, source

* fix data source transform

* fix parse_dataset register_op

* fix scale_factor, RandomAffine

* add assert for check

* fix ci
jerrywgz pushed a commit to jerrywgz/PaddleDetection that referenced this pull request Dec 6, 2022
* add mot data

* fix operators, source

* fix data source transform

* fix parse_dataset register_op

* fix scale_factor, RandomAffine

* add assert for check

* fix ci
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.

None yet

6 participants