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

add SQR for Deformable DETR #8579

Merged
merged 9 commits into from
Sep 24, 2023
Merged

add SQR for Deformable DETR #8579

merged 9 commits into from
Sep 24, 2023

Conversation

flytocc
Copy link
Contributor

@flytocc flytocc commented Aug 28, 2023

基于PPDET Deformable DETR复现SQR增强策略 #8498

测试环境:

  • AIStudio 脚本任务
  • Paddle 2.4.0
  • Python 3.7
  • CUDA 11.2
  • GPU: 4 * V100 32GB

启动脚本如下:

# fix aistudio env bug
pip install imgaug>=0.4.0
pip install pycocotools-2.0.6.tar.gz
pip install -U matplotlib

# code
unzip PaddleDetection.zip
cd PaddleDetection

# data
unzip -d dataset/coco/ /root/paddlejob/workspace/train_data/datasets/data103218/train2017.zip
unzip -d dataset/coco/ /root/paddlejob/workspace/train_data/datasets/data103218/val2017.zip
unzip -d dataset/coco/ /root/paddlejob/workspace/train_data/datasets/data103218/annotations_trainval2017.zip

# multi-gpu training
python -m paddle.distributed.launch \
  tools/train.py \
  -c configs/sqr/deformable_detr_sqr_r50_12e_coco.yml \
  -o worker_num=4 save_dir=/root/paddlejob/workspace/output/ log_iter=100 \
  TrainReader.batch_size=1 LearningRate.base_lr=0.000025 \
  --fleet \
  --eval
config AP 参考精度 (pytoch) 权重和训练日志
configs/sqr/deformable_detr_sqr_r50_12e_coco.yml 32.9 33.0 百度网盘

@paddle-bot
Copy link

paddle-bot bot commented Aug 28, 2023

Thanks for your contribution!

@@ -122,9 +122,10 @@ def forward(self,
out_bbox.unsqueeze(1) - tgt_bbox.unsqueeze(0)).abs().sum(-1)

# Compute the giou cost betwen boxes
cost_giou = self.giou_loss(
giou_loss = self.giou_loss(
Copy link
Collaborator

Choose a reason for hiding this comment

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

这块改的原因是什么 对其他模型通用嘛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这块原本的cost_giou是算错的,不过对后面计算linear_sum_assignment没有影响,所以其他模型也没有影响

Copy link
Collaborator

Choose a reason for hiding this comment

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

建议你新增一个flag 其他的模型就不需要重新验证了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

建议你新增一个flag 其他的模型就不需要重新验证了

我觉得不需要,cost_giou只被用在计算C,C只被用在计算linear_sum_assignment,而cost_giou整体增大一个常数对linear_sum_assignment是没有影响的

@@ -124,7 +124,7 @@ def update(self, inputs, outputs):

def accumulate(self):
if len(self.results['bbox']) > 0:
output = "bbox.json"
output = f"bbox_{paddle.distributed.get_rank()}.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

这块改的原因是什么

Copy link
Contributor Author

Choose a reason for hiding this comment

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

为了避免多卡eval时,重复写入造成文件损坏。

Copy link
Collaborator

Choose a reason for hiding this comment

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

现在的ppdet多卡eval逻辑是不对的 没有mege最终的结果的逻辑 这块还保持原来的逻辑吧

@lyuwenyu
Copy link
Collaborator

另外在configs下面加一个简单的readme吧

@flytocc
Copy link
Contributor Author

flytocc commented Sep 13, 2023

另外在configs下面加一个简单的readme吧

加了

@shiyutang shiyutang removed the request for review from cuicheng01 September 22, 2023 06:50
Copy link
Collaborator

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

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

LGTM

@shiyutang shiyutang merged commit efcb6ad into PaddlePaddle:develop Sep 24, 2023
3 checks passed
@flytocc flytocc deleted the SQR branch October 8, 2023 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants