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

CodeCamp #151[Feature] Support HieraSeg on cityscapes #2444

Merged
merged 68 commits into from
Jan 12, 2023
Merged

CodeCamp #151[Feature] Support HieraSeg on cityscapes #2444

merged 68 commits into from
Jan 12, 2023

Conversation

AI-Tianlong
Copy link
Contributor

@AI-Tianlong AI-Tianlong commented Dec 30, 2022

Support HieraSeg interface on cityscapes

Motivation

Support HieraSeg interface on cityscapes dataset
Paper link : https://ieeexplore.ieee.org/document/9878466/

@article{li2022deep,
  title={Deep Hierarchical Semantic Segmentation},
  author={Li, Liulei and Zhou, Tianfei and Wang, Wenguan and Li, Jianwu and Yang, Yi},
  journal={CVPR},
  year={2022}
}

Modification

Add HieraSeg_Projects on projects/
Add sep_aspp_contrast_head decoder head.
Add HieraSeg config.
Add hiera_loss, hiera_triplet_loss_cityscape, tree_triplet_loss

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

BLUE-coconut and others added 30 commits November 30, 2022 20:18
CodeCamp #144 [Doc] Chinese version of config tutorial
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
CodeCamp #147 [Doc] Add Chinese version of train & test tutorial
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
CodeCamp #1562 [Doc] Add Chinese version of `overview.md`
[Doc] Add ZN datasets.md in dev-1.x
projects/HieraSeg_project/README.md Outdated Show resolved Hide resolved
projects/HieraSeg_project/README.md Outdated Show resolved Hide resolved
projects/HieraSeg_project/README.md Outdated Show resolved Hide resolved
projects/HieraSeg_project/losses/hiera_loss.py Outdated Show resolved Hide resolved
import torch.nn.functional as F


class TreeTripletLoss(nn.Module):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might also add to register and support customizing parameters

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might add docstring.

super().__init__()
self.num_classes = num_classes
self.loss_weight = loss_weight
self.treetripletloss = TreeTripletLoss(19, hiera_map, hiera_index)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might support customizing.

Comment on lines 55 to 62
MCMA = predictions[:, :num_classes, :, :]
MCMB_back = torch.max(
torch.cat([
predictions[:, 0:1, :, :],
predictions[:, num_classes:num_classes + 1, :, :]
],
dim=1), 1, True)[0]
MCMB1 = torch.max(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might add some comments to explain what MCMA, MCMB, and others mean.

feats_pos = feats[index_pos][:min_size]
feats_neg = feats[index_neg][:min_size]

distance = torch.zeros(min_size, 2).cuda()
Copy link
Collaborator

Choose a reason for hiding this comment

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

the device of model training might be not cuda.

Suggested change
distance = torch.zeros(min_size, 2).cuda()
distance = torch.zeros(min_size, 2).to(feats)

@MeowZheng MeowZheng merged commit ce09639 into open-mmlab:dev-1.x Jan 12, 2023
MeowZheng pushed a commit that referenced this pull request Feb 6, 2023
## Motivation
Supplementary PR #2444 
Fix tiny bug and add loss_by_feat() to compute loss to train.
The inference process have verified to be accurate.
## Modification
- modify `sep_aspp_contrast_head.py` , add `loss_by_feat()` function to
train(training still has bug, will fix in future😫)
- fix testing commands path error `bash tools/dist_test.sh
projects/HieraSeg_project/` to `bash tools/dist_test.sh
projects/HieraSeg/` at README.md
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
…-mmlab#2444)

## Support `HieraSeg` interface on `cityscapes`

## Motivation

Support `HieraSeg` interface on cityscapes dataset  
Paper link : https://ieeexplore.ieee.org/document/9878466/

```
@Article{li2022deep,
  title={Deep Hierarchical Semantic Segmentation},
  author={Li, Liulei and Zhou, Tianfei and Wang, Wenguan and Li, Jianwu and Yang, Yi},
  journal={CVPR},
  year={2022}
}
```

## Modification

Add `HieraSeg_Projects` on `projects/`
Add `sep_aspp_contrast_head` decoder head.
Add `HieraSeg` config.
Add `hiera_loss`, `hiera_triplet_loss_cityscape`, `tree_triplet_loss`
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
open-mmlab#2565)

## Motivation
Supplementary PR open-mmlab#2444 
Fix tiny bug and add loss_by_feat() to compute loss to train.
The inference process have verified to be accurate.
## Modification
- modify `sep_aspp_contrast_head.py` , add `loss_by_feat()` function to
train(training still has bug, will fix in future😫)
- fix testing commands path error `bash tools/dist_test.sh
projects/HieraSeg_project/` to `bash tools/dist_test.sh
projects/HieraSeg/` at README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Related issue of 1.x version High Priority from Community This issue/pr needs more attention and higher priority than default developing plan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants