{"id":20826746,"url":"https://github.com/cedrickchee/kaggle-facial-detection","last_synced_at":"2025-03-12T07:23:39.414Z","repository":{"id":138118337,"uuid":"119682979","full_name":"cedrickchee/kaggle-facial-detection","owner":"cedrickchee","description":"Facial keypoints detection challenge tutorial and solution for Singapore Kaggle ML Challenge meetup.","archived":false,"fork":false,"pushed_at":"2018-11-12T06:06:57.000Z","size":1053,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T17:49:37.335Z","etag":null,"topics":["datascience","deeplearning","educational","kaggle-competition","kaggle-facialkeypoints","project"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedrickchee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-01-31T12:14:40.000Z","updated_at":"2024-11-01T11:35:59.000Z","dependencies_parsed_at":"2024-03-26T12:15:18.100Z","dependency_job_id":null,"html_url":"https://github.com/cedrickchee/kaggle-facial-detection","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/cedrickchee%2Fkaggle-facial-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fkaggle-facial-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fkaggle-facial-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fkaggle-facial-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedrickchee","download_url":"https://codeload.github.com/cedrickchee/kaggle-facial-detection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243174008,"owners_count":20248216,"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":["datascience","deeplearning","educational","kaggle-competition","kaggle-facialkeypoints","project"],"created_at":"2024-11-17T23:09:55.281Z","updated_at":"2025-03-12T07:23:39.404Z","avatar_url":"https://github.com/cedrickchee.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kaggle Facial Keypoints Detection Challenge\n\n## Introduction\n\n### Singapore Kaggle Machine Learning Challenge Meetup Group\n\nThe [Singapore (SG) Kaggle Machine Learning (ML) Challenge Meetup group](https://www.sginnovate.com/events/kaggle-machine-learning-meetup-0) organized the [first Kaggle meetup](https://www.meetup.com/Singapore-Kaggle-Machine-Learning-Challenge/events/245657152/) in Singapore on Jan 9 2018.\n\nIn this meeting, attendees formed teams with like-minded data scientists on Kaggle challenges of interest. In the following six weeks, the team will discuss the challenge, form a strategy and implement it. The outcome would then be presented to the audience at the Data Science Evening (our second meeting).\n\n[The first meetup is off to a great start](https://twitter.com/cedric_chee/status/950790721216315392).\n\nHere's some photos from the first event:\n\n\u0026nbsp;         | \u0026nbsp;\n-------------- | ------------------\n![](https://pbs.twimg.com/media/DTHi66xUQAAlDGr.jpg) | ![](https://pbs.twimg.com/media/DTHi-cyV4AAadxa.jpg) |\n![](https://pbs.twimg.com/media/DTHjBeHU0AA6kHC.jpg) | ![](https://pbs.twimg.com/media/DTHjFDDUQAEDq5j.jpg)\n\n**Updates:**\n- 2018-06-26:\n    - SG Kaggle ML Group disbanded.\n- 2018-11-12:\n    - Fix broken link to the group's Meetup.com page.\n    - Add photos from the first event.\n\n### Our Team\n\nWe are Team 12 (BestFitting). Our team consists of:\n- Puay Ni Yi (leader)\n- Teh Guo Pei\n- Cedric Chee\n\nWe are tackling the [facial keypoints detection](https://www.kaggle.com/c/facial-keypoints-detection) as our first Kaggle challenge.\n\n### Project\n\nThis is a 6-weeks project.\n\n#### Plan\n\nWe will use this repo as the central location to host all the tutorials and solutions for the challenge.\n\n## The Challenge\n\nFacial Keypoints Detection is a challenge focused on Computer Vision field. The techniques to solve this challenge is usually from Deep Learning and Convolutional Neural Networks (CNN).\n\n### Overview\n\nThe objective of this task is to detect and predict keypoint positions (locations) on face images. To learn more, take a look [here](https://www.kaggle.com/c/facial-keypoints-detection).\n\n## Tutorial\n\n### Deep Learning Tutorial\n\nWe are basing our tutorial from [Daniel Nouri's blog post](https://www.kaggle.com/c/facial-keypoints-detection#deep-learning-tutorial).\n\nAs we are planning to use TensorFlow for implementing our solution, we will follow this [tutorial by Alex Staravoitau](https://navoshta.com/facial-with-tensorflow/). Alex's tutorial was based on the amazing tutorial by Daniel Nouri.\n\nDependencies/Libraries used:\n- [nolearn](https://github.com/dnouri/nolearn), a scikit-learn wrapper for Lasagne.\n- Theano\n- scikit-learn\n- TensorFlow\n- matplotlib\n- pandas\n- jupyter\n- numpy\n\n#### Installation and Setup\n\n- Step 1 - install all dependencies:\n```bash\n$ git clone https://github.com/cedrickchee/kaggle-facial-detection.git\n$ cd kaggle-facial-detection\n$ pip install -r requirements.txt\n```\n\n##### Problems/issues encountered:\n- Theano\n    - Error `ValueError: You are tring to use the old GPU back-end. It was removed from Theano. Use device=cuda* now ...`. Solution on how to [converting to the new gpu back end(gpuarray)](https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29).\n        - Either set the environment variable, `THEANO_FLAGS='device=cuda'` or\n        - edit Theano config file, `~/.theanorc`\n        ```bash\n        [global]\n        device = cuda\n        ```\n    - Error `(theano.gpuarray): pygpu was configured but could not be imported or is too old (version 0.7 or higher required)`. To resolve this problem, [install `libgpuarray` Python library](http://deeplearning.net/software/libgpuarray/installation.html).\n        - In the middle of this process, at the step when you install `pygpu` by running this command, you will encounter new error `ModuleNotFoundError: No module named 'Cython'`. Work around this by installing Cython with this command: `pip install Cython`\n        ```bash\n        $ python setup.py build\n        ```\n    - Error `ImportError: libgpuarray.so.3: cannot open shared object file: No such file or directory` when you try to `import pygpu`. GitHub [thread](https://github.com/Theano/libgpuarray/issues/89#issuecomment-144826220) discussing this problem. [How to fix shared object file error](https://codeyarns.com/2014/01/14/how-to-fix-shared-object-file-error/). Append `/usr/local/lib` path to `LD_LIBRARY_PATH` in `.bashrc`\n    ```bash\n    LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH\n    ```\n- nolearn, a sckit-learn wrapper for Lasagne\n    - Error `ImportError: cannot import name 'downsample'` when trying to `import lasagne`. This can be solved [this way](https://github.com/Lasagne/Lasagne/issues/867). The [cause](https://github.com/Theano/Theano/issues/4337#issuecomment-332041284) of the problem.\n    ```bash\n    $ pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip\n\n    ```\n\n## Solution\n\nJupyter Notebook with Cedric's attempts to tackle the competition is in the [notebooks](notebooks) folder.\n\n1. First model: [a single hidden layer](notebooks/1_single_hidden_layer.ipynb)\n    - A very simple neural network (NN).\n2. Second model: [convolutions](notebooks/2_convolutions.ipynb)\n    - Convolutional neural network (CNN) with data augmentation, learning rate decay and dropout.\n3. Third model: [training specialists](notebooks/3_training_specialists.ipynb)\n    - A pipeline of specialist CNNs with early stopping and supervised pre-training.\n4. Fourth model:\n    - ResNet-50 architecture and large scale training with methods from cutting-edge research such as [1cycle policy](https://sgugger.github.io/the-1cycle-policy.html), super convergence, weight decay, batch normalization, dropout and data transformation.\n\n## Results\n\nRanking on Leaderboard among 175 teams.\n\n| Team Member   | Private Score        | Public Score         | Best Model |\n| ------------- | -------------------- | -------------------- | ---------- |\n| Cedric        | 1.96686 (26th place) | 2.15043 (16th place) | #3         |\n\nWe think that there is a lot of room for improving our leaderboard score as we are still trying out new ideas and developing new techniques from it for our fourth and final model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickchee%2Fkaggle-facial-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedrickchee%2Fkaggle-facial-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickchee%2Fkaggle-facial-detection/lists"}