{"id":15911732,"url":"https://github.com/drgfreeman/rps-cv-data-science","last_synced_at":"2025-08-15T00:32:59.808Z","repository":{"id":130571694,"uuid":"170419159","full_name":"DrGFreeman/rps-cv-data-science","owner":"DrGFreeman","description":"Data Science fun using the image dataset from my rps-cv project","archived":false,"fork":false,"pushed_at":"2019-03-05T13:37:04.000Z","size":12170,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T03:51:07.798Z","etag":null,"topics":["computer-vision","data-visualization","game","image-classification","image-recognition","machine-learning","opencv","opencv-python","principal-component-analysis","rock-paper-scissors","skimage","sklearn"],"latest_commit_sha":null,"homepage":"https://github.com/DrGFreeman/rps-cv","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/DrGFreeman.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":"2019-02-13T01:29:49.000Z","updated_at":"2022-04-03T13:07:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"d753a34e-c2a4-4f85-978e-0507b76f0fba","html_url":"https://github.com/DrGFreeman/rps-cv-data-science","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"a40e77279a0e61c8c93b6eb061dd752fb72262be"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DrGFreeman/rps-cv-data-science","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrGFreeman%2Frps-cv-data-science","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrGFreeman%2Frps-cv-data-science/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrGFreeman%2Frps-cv-data-science/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrGFreeman%2Frps-cv-data-science/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrGFreeman","download_url":"https://codeload.github.com/DrGFreeman/rps-cv-data-science/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrGFreeman%2Frps-cv-data-science/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270505601,"owners_count":24596501,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-visualization","game","image-classification","image-recognition","machine-learning","opencv","opencv-python","principal-component-analysis","rock-paper-scissors","skimage","sklearn"],"created_at":"2024-10-06T16:00:45.976Z","updated_at":"2025-08-15T00:32:58.423Z","avatar_url":"https://github.com/DrGFreeman.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rps-cv-data-science\nData Science fun using the image dataset from my **rps-cv** project:\n\n**A Rock-Paper-Scissors game using computer vision and machine learning on Raspberry Pi**.\n\nCheckout the **rps-cv** project repository on GitHub at [DrGFreeman/rps-cv](https://github.com/DrGFreeman/rps-cv)\n\n![banner image](banner.png)\n\n## Notebooks\nThe following Jupyter notebooks are included in the repository:\n\n### Classification\n* [*pca-svm_classifier_skopt.ipynb* ](pca-svm_classifier_skopt.ipynb)  \nThis notebook shows how to train a Support Vector Machine classifier on the grayscale images using Principal Component Analysis for dimensionality reduction and Bayesian optimization of the model hyperparameters. The model is trained using 75% of the dataset with a five fold cross-validation and achieves a [F1](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html#sklearn.metrics.f1_score)  (micro) score of 97.6% on a test set of 547 images (the remainig 25% of the dataset)\n\n### Visualization/Interpretation\n* [*pca_visualization.ipynb*](pca_visualization.ipynb)  \nThis notebook presents a visualisation of the Principal Component Analysis (PCA) method used as dimensionality reduction in my **Rock-Paper-Scissors game** project. The objective of the notebook is mainly  to develop an intuition of the meaning of PCA applied to images rather than to present a mathematically rigorous definition of PCA.\n\n* [*pca_viz-interactive.ipynb*](pca_viz-interactive.ipynb)  \nThis notebook is similar to the *pca_visualization* notebook except it uses interactive sliders to display the image reconstruction using principal components. Note that GitHub does not render the interactive widgets.\n\n## Getting started\nTo get started, download or clone this repository:\n\n```\n$ git clone https://github.com/DrGFreeman/rps-cv-data-science.git\n```\n\nThen download and extract the [dataset](#dataset) and install the required [dependencies](#dependencies) as per instructions below.\n\nOnce the above steps are completed, launch Jupyter Lab with the command\n\n```\n$ jupyter lab\n```\n\nor Jupyter notebook with the command\n\n```\n$ jupyter notebook\n```\n\n## Dataset\nThe dataset consists of 2188 images of Rock, Paper and Scissors hand gestures captured from the **rps-cv** game. The dataset is relatively well balanced, with 710, 726 and 752 images of the Rock, Paper and Scissors gestures respectively. The images corresponding to each gesture are stored in subdirectories named *rock*, *paper* and *scissors*.\n\nThe dataset is released under the Creative Commons Attribution Share-Alike 4.0 license (CC-BY-SA 4.0).\n\nThe dataset can be downloaded from the following link: https://www.dropbox.com/s/sr1iui3zfdk0o53/rps-cv-image.zip. The images can then be extracted into the *img* directory of the cloned repository. On Linux, this can be done from the command line:\n\n```\n$ cd rps-cv-data-science\n$ wget https://www.dropbox.com/s/sr1iui3zfdk0o53/rps-cv-images.zip\n$ unzip rps-cv-images.zip -d img/\n$ rm rps-cv-images.zip\n```\n\n## Dependencies\nThe Jupyter notebooks in this repository depend on different Python packages. The simplest way to install all the required packages is by using the [Anaconda Distribution](https://www.anaconda.com/distribution/) and the `conda` package manager.\n\nTwo environment files are provided to setup conda virtual environments, one base environment for the traditional machine learning tasks using Scikit-Learn, and one for both traditional machine learning using Scikit-Learn and deep-learning using the Keras library and GPU accelerated Tensorflow backend.\n\nTo setup an environment with the base libraries use the *environment-base.yml* environment file:\n\n```\n$ conda env create -f environment-base.yml\n```\n\nThis will create an environment named *rps-cv* that can be activated with the command\n\n```\n$ conda activate rps-cv\n```\n\nTo setup an environment for deep-learning using Keras, use the *environment-keras-gpu.yml* environment file:\n\n```\n$ conda env create -f environment-keras-gpu.yml\n```\n\nThis will create an environment named *rps-cv-keras* that can be activated with the command\n\n```\n$ conda activate rps-cv-keras\n```\n\nNote that this second environment installs the GPU accelerated versions of Keras and the Tensorflow backend. This will only work if your computer is equipped with a Cuda compatible Nvidia GPU. Running the artificial neural network notebooks from this repository is intractable on a CPU.\n\n### Managing conda environments within Jupyter Lab/Notebook\nTo allow changing the conda environments from within Jupyter Lab or Jupyter Notebook, install the `nb_conda` package in the *base* conda environment:\n\n```\n(base) $ conda install nb_conda\n```\n\nJupyter Lab or Jupyter Notebook can then be launched from the *base* environment and the desired kernel (conda environment) selected within Jupyter.\n\n### Interactive widgets in Jupyter Lab\nTo use the interactive widgets in jupyter lab, the ipywidgets jupyter lab extension must be installed with the following command:\n\n```\n(rps-cv) $ jupyter labextension install @jupyter-widgets/jupyterlab-manager\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrgfreeman%2Frps-cv-data-science","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrgfreeman%2Frps-cv-data-science","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrgfreeman%2Frps-cv-data-science/lists"}