mmdetection
mmdetection copied to clipboard
[Enhance] Added label smoothing to cross entropy loss
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.
Hi @tjaffri ,
Thanks for your kind PR. Could you sign the CLA so that we finally could merge this PR after review?

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 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.
@ZwwWayne gentle ping. Please let me know if I can improve this PR further.
Hello @tjaffri.
Thanks for your valuable contribution. I have left some comments above. Please remember to check.
Best wishes,
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