mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Enhance] Added label smoothing to cross entropy loss

Open tjaffri opened this issue 3 years ago • 6 comments
trafficstars

Motivation

Add label smoothing to cross entropy loss

Modification

Adds a call to the newly added pytorch label_smoothing capability: https://pytorch.org/docs/stable/generated/torch.nn.functional.cross_entropy.html#torch.nn.functional.cross_entropy

BC-breaking (Optional)

Requires pytorch 1.10.0 or higher. The label_smoothing parameter was added in this release: https://pytorch.org/docs/1.10.0/generated/torch.nn.functional.cross_entropy.html#torch.nn.functional.cross_entropy and did not exist before.

Use cases (Optional)

Add label smoothing to cross entropy loss in your config.

tjaffri avatar Mar 27 '22 07:03 tjaffri

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 27 '22 07:03 CLAassistant

Hi @tjaffri , Thanks for your kind PR. Could you sign the CLA so that we finally could merge this PR after review? image

ZwwWayne avatar Mar 27 '22 07:03 ZwwWayne

Hi @tjaffri , Since this PR require the new pytorch feature, could you add the version check? For example, only allow label_smoothing to be set when pytorch version is > 1.10.

ZwwWayne avatar Mar 30 '22 15:03 ZwwWayne

@ZwwWayne feedback appreciated on how I did the python version condition check. If you have a different preferred pattern, I would appreciate a pointer. For now I'm just ignoring label_smoothing if the python version is less than 1.10.

tjaffri avatar Apr 02 '22 11:04 tjaffri

@ZwwWayne gentle ping. Please let me know if I can improve this PR further.

tjaffri avatar Apr 09 '22 12:04 tjaffri

Hello @tjaffri.

Thanks for your valuable contribution. I have left some comments above. Please remember to check.

Best wishes,

jbwang1997 avatar Apr 20 '22 02:04 jbwang1997

Hi @tjaffri!We are grateful for your efforts in helping improve this open-source project during your personal time. Welcome to join OpenMMLab Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/UjgXkPWNqA If you have a WeChat account,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:) Thank you again for your contribution❤ @tjaffri

OpenMMLab-Assistant003 avatar Apr 12 '23 08:04 OpenMMLab-Assistant003