{"id":15676799,"url":"https://github.com/mratsim/humpback-whale-identification","last_synced_at":"2025-05-07T00:28:57.576Z","repository":{"id":85263731,"uuid":"179803917","full_name":"mratsim/humpback-whale-identification","owner":"mratsim","description":"Kaggle Humpback whale identification: 2xGPU Data augmentation + FP16 mixed precision training ","archived":false,"fork":false,"pushed_at":"2019-04-08T12:28:56.000Z","size":2184,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-02T02:47:21.841Z","etag":null,"topics":["computer-vision","data-science","identification","kaggle","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mratsim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-06T07:46:58.000Z","updated_at":"2024-01-28T11:53:03.000Z","dependencies_parsed_at":"2023-05-25T02:30:41.189Z","dependency_job_id":null,"html_url":"https://github.com/mratsim/humpback-whale-identification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mratsim%2Fhumpback-whale-identification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mratsim%2Fhumpback-whale-identification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mratsim%2Fhumpback-whale-identification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mratsim%2Fhumpback-whale-identification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mratsim","download_url":"https://codeload.github.com/mratsim/humpback-whale-identification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252790361,"owners_count":21804582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","data-science","identification","kaggle","pytorch"],"created_at":"2024-10-03T16:05:40.806Z","updated_at":"2025-05-07T00:28:57.555Z","avatar_url":"https://github.com/mratsim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Humpback whale identification\n\nThe challenge if you choose to accept it, within Happywhale database of 25000 images of whale flukes,\nidentify the 3000+ whales that appear 1, 2 or 3 times.\n\nFor example here are 2 different images with the same whale\n\n![](images/happy-whale.jpg)\n\nAnd here is a sample of 10 whale's flukes we had to work with\n\n![](images/0a0c1df99.jpg)\n![](images/0a00c7a0f.jpg)\n![](images/0a1a0c3f7.jpg)\n![](images/0a1aa01e8.jpg)\n![](images/0a1e6d6df.jpg)\n\n## What you will find here\n\nDisclaimer, the code is a baseline setup code with a low mAP@5 score of 0.30.\n\nThis is an example of how to use [Nvidia DALI](https://github.com/NVIDIA/DALI) for pure GPU data augmentation and [Nvidia APEx](https://github.com/NVIDIA/apex) for multi-precision training (FP16+FP32) on a 2x2080Ti setup with PyTorch `DataParallel`. (Note: Nvidia deprecated the APEx API I was using, replacement is straightforward)\n\nVersions (version.release.commithash):\n  - PyTorch - v1.0rc0.r2098.gded4ff87af\n  - Nvidia DALI - v0.7.0.dev.r64.gd2bcc4a8\n  - Nvidia APEx - r226.3c7a0e4\n\nFor Archlinux users, PKGBUILDs of my data science environment are available in my [Data Science repo](https://github.com/mratsim/Arch-Data-Science/tree/8d398b2aea2114a039b286a4c194d967ca01af6f).\n\nThis setup avoids being bottlenecked on CPU data augmentation in many cases when using \"simple\" networks like ResNet50.\n\nFurthermore, you will find an pure PyTorch to FastAI and Leslie Smith super-convergence and learning rate finder. FastAI is a tremendous effort to make deep learning best practice at your fingertips, however you lose some flexibility on models, logging and other utilities that would be useful in a competitive or production setup.\n\nLastly but not least, you will find several papers on identification tasks (commonly called Re-Id) which goes into deep details into various techniques for similarity learning like Siamese networks, Triplet Loss, re-identification networks, figure-of-merit learning.\n\nBonus: I'm pretty confident I've implemented the fastest mAP@5 function in Python + Deep Learning library.\n\n## Papers\n\n\n### Neural Network Architectures\n\n- Learning similarity, Metric learning, Low-shot learning, One-shot learning:\n    - Siamese Networks: https://www.cs.cmu.edu/~rsalakhu/papers/oneshot1.pdf\n    - Generative Adversarial Network\n    - Triplet network\n      - https://omoindrot.github.io/triplet-loss\n      - Deep Metric Learning using Triplet Network: https://arxiv.org/abs/1412.6622\n      - Deep Triplet Ranking Networks for One-Shot Recognition: https://arxiv.org/abs/1804.07275v1\n      - http://openaccess.thecvf.com/content_ICCV_2017_workshops/papers/w6/Liao_Triplet-Based_Deep_Similarity_ICCV_2017_paper.pdf\n      - In Defense of the Triplet Loss for Person Re-Identification - https://arxiv.org/pdf/1703.07737\n      - Quadruplet Loss: https://arxiv.org/abs/1704.01719\n      - Histogram Loss: https://arxiv.org/abs/1611.00822\n- Matching network: https://arxiv.org/abs/1606.04080\n- Re-Identification networks\n  - https://github.com/KaiyangZhou/deep-person-reid and https://github.com/KaiyangZhou/deep-person-reid/blob/master/AWESOME_REID.md\n  - Dolphin ReID with metric embedded learning: https://arxiv.org/abs/1901.03662\n- Meta learning: https://openreview.net/pdf?id=rJY0-Kcll\n- Neural Turing Machine\n  - https://arxiv.org/pdf/1410.5401\n  - One shot learning: https://arxiv.org/abs/1605.06065\n- Unsupervised pretraining: http://www.jmlr.org/papers/volume11/erhan10a/erhan10a.pdf\n  - Pretraining with an autoencoder\n  - Not gradient based\n    - Restricted Boltzmann machine \u0026 Deep Belief Network\n    - Conditional Random Field\n- Multi stage with a segmentation/Region Proposal network and then a predictor on the crops\n\n- Training from Scratch: https://arxiv.org/pdf/1811.08883.pdf\n\n### Loss function and optimizing directly for mAP\n\n- Can we do a differentiable Map@5?\n- Optimisation and Operations Research techniques\n  https://pdfs.semanticscholar.org/769b/67b5e953966524bdcbec657a0e44bdc62cba.pdf\n  - Linear Assignment Problem\n  - Nonsmooth optimization:\n    - Bundle method\n    - Stochastic Gradient Descent\n    - Constrained Quadratic Programming\n  - SmoothGrad method\n  \u003e The rationale is to compare our upper bound with an\n  \u003e approximation of the ranking score to assess whether\n  \u003e the approximation provides any benefit.  The basic idea is to perform a direct gradient\n  \u003e descent optimization on a smoothed version of the NDCG measure\n- Scalable Learning of Non-Decomposable Objectives: https://arxiv.org/pdf/1608.04802.pdf\n- An Efficient Gradient-based Approach to Optimizing Average Precision Through Maximal Figure-of-Merit Learning:\n  https://www.researchgate.net/publication/257672531_An_Efficient_Gradient-based_Approach_to_Optimizing_Average_Precision_Through_Maximal_Figure-of-Merit_Learning (Paywalled ....)\n- A Maximal Figure-of-Merit Learning Approach to Maximizing Mean Average Precision with Deep Neural Network Based Classifiers\n  http://www.mirlab.org/conference_papers/international_conference/ICASSP%202014/papers/p4536-li.pdf\n\n### Learning rate and super-convergence\n\n  - One-cycle Policy: https://arxiv.org/abs/1506.01186\n  - Super convergence: https://arxiv.org/pdf/1708.07120.pdf and https://github.com/lnsmith54/super-convergence\n  - SGDR Stochastic gradient descent with restart: sudden increase of LR to hop out of local minima\n    https://arxiv.org/pdf/1608.03983.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmratsim%2Fhumpback-whale-identification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmratsim%2Fhumpback-whale-identification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmratsim%2Fhumpback-whale-identification/lists"}