<h1 align="center"><img src="https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/img/logo-light.png" width=27px height=27px> Glasses Detector</h1>
<div align="center">
[![Colab](https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/svg/colab.svg)](https://colab.research.google.com/github/mantasu/glasses-detector/blob/main/notebooks/demo.ipynb)
[![Docs](https://github.com/mantasu/glasses-detector/actions/workflows/sphinx.yaml/badge.svg)](https://mantasu.github.io/glasses-detector/)
[![PyPI](https://img.shields.io/pypi/v/glasses-detector?color=yellow&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAsCAMAAAAQPRtoAAAB9VBMVEVHcEzY2Nnr6ufb2dDCxtDp6eXq6ufQz8rHycj5+vvo6OXm5d+9xctWfqDl5eTf393m5uPz8/Dbz6Zzkav40E/19fTu7u7f391Dcpnm5eOGnrJSha7vzmY7bJb00V9sjqr0yT7x8fB9mbHy8vL7+/vp6ObpzXTnzXnl5eTo5+X80kzg4N5OeZ309PFHc5rr6ujr0X/09PHy0GbpzXTx0Gjyykv7ySlZgKFUfZ9Xf6H29fJpiqd3lKxhhaRsj5jy8vI3danv7ur/0kIvZJH/////0kE1dKnu7eoyZpIuY5Ht7ek0c6r50VL90kc4dqorYpD40VVLfaY8eKr29vNLga780kvz8/E+bpcwZZHp6OXs7Oh4l7H39/Tr6uc3aZROg679/Pr/00NvkZg6d6xEfKxBcZlThrDy8OtHfqz20Vz/0j/62nZIdZtFc5r00WBKe6T+0kL357WUo4tPeZ750EuMp7z30VhXiLJjj7Rdh6nx8e4/eqv/yR3k5uaAnLQ4dqmXssn6ySitsYiYppHLvnPCz9hqkKC0xdKCnZ/u7ev5+PX3z0tQf6ZKeJ//3G3X2tzexmzz5br1y0TT3+p0nsF+pMT12oVXgaU6d6rw0W779d/55aX/2Fz/5pWoucbtzFnn3LHN1NhukKz279egvdb7yi7/++/yPOqTAAAAQHRSTlMAA+0iB9a7Egz+0HIXpT02gewsT+fPiEvdlSvVgP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0W9e6N/X0TAkf40e9/xWweGJ9cjL9Y+4NB3xQYP7U1+t+WSi6c1ROnmAj/uTQjeAPPN+ZH7Xdz2zsG+PcTKIvlyNEDHQZRT+AHJjG/tvHMglasEtgnMP7tn28pV1mXuc2hI2gElao1TyGYvlOfmqof4YOH9ot64ihrCeD4q6dO9OivvY5jx/dJLQjIXf2i+Q1hunwRFuhoIHzfZ63vIWMPjKUnT7QBWtyqKFaVXDjf1dO+h8sexQpDgk6gc69/FAbTNXOb+XLrn4n/AS3T2zxNRKClAAAAAElFTkSuQmCC)](https://pypi.org/project/glasses-detector/)
[![Python](https://img.shields.io/badge/python-≥%203.12-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAbqSURBVGiBxZp/bFVnGcc/77m3P6C4MBhWcCKFaDI2ox37w0YSWdhANxp/TDeFuCXESTTqtsoEHcY757Rp3TJ/zD9YpmEki6IxmRtxqBl3kdHxR80qmyMS4gZD2tBRgwJt7z3P1z/uPe05t/fXObfUJ3nT95znnPN+v8+v97nn1NGoSK67/4VOH3UhrfZNHZhWSHalUKukhZImJbuANCHTsMlOgr0hub95kxzI9t32VqMwXNIb12UOtra1cY/QV5CWS4YkZCr8DY4lCB/P1PtI+/yUu3/g4dtPzymRDf0H2ppc85+QukpBF8BaiEDd+hGTf8vL/V/4axJMXpKbmr2mB6ZJCJNeQfqjpPEAIGHgJaOCvt3JPdd1375Fc0ZExu3T1tWDB3Zu6Hz+Wxs3Oo8PI12MSSA8lhrj988NEclJurq48KRry/0wUB3Y+bEhyZ6JgrMSAiVhVqrHPjMnRG7tPbRQqKVo4VTTpVxzlKdaRQ0PVNWzgkwmNq7YN6RsojkEIDWeb3nss5l9zQDrH9q/SVJ3whwJPJRelwBXOu4NQCQsJG0dS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21bXRmfm0XiofUrJoCNTbJyUDHxo86RzyAJzjiaLpq+eI1ZvQJQsym+ADQwngv+S8PVD8YZXNfOoVTD8uvECIVquwh0LvT8okdJ2gaDT5Q9Z0/MBd/5ezU0QAXPPib0q2t1qIlfdCA2EzIxRrPCu64/6O15b1BQdTr4OymRvzwJ1rdzz9GxN3U2jv36nQjy4zC3miVqWpdzOrcU1QtQoyCu4foF9y7Uu/cNdNB3vsT28auacd34ZjABt3K381L+46cSXR2/hIqNS2alonbust2C50nnxhboHFgzlwTfbbzpUvLZUkgUe+2E4uNTyLfRIznnU23eRuzOarwJghCT0SA1TcXT2hxCdyAUiXNnZ1thrR607i9AzyVyDbBEr8zT8ZESjmSEN90htMqNN1Zv8NoKMf2Y6jvxEi8T/0tHr/mYVW47cBCQAmxp8IrXAxbn4kIuKW7b6I/GMNthrvjjx0XuvV0wswFBcTJA0t838C9vMKYUPN0II7dHTtn5m4tJfmee8BhT3yeBJIiRJMynicOPo02B0x8qJwPip5osZ8yl330l1JMCX6GOpcxljlbUH+g8ifTNAnBRKQGEfaxd+XbU2CBxr4N6dAdKy7A29yG6Y7kS2t0ieVk1M49uK0260+/Ga1C2tJw0QC0cF1adq5gcI/oHVhtgpP7YglOHcJaQzH24hXkY7g6WVWDwzFbUUqyf8ASQ3KW+bpq4sAAAAASUVORK5CYII=)](https://docs.python.org/3/)
[![CUDA](https://img.shields.io/badge/cuda-yes-5eb304?logo=nvidia)](https://developer.nvidia.com/cuda-toolkit)
[![DOI](https://img.shields.io/badge/doi-10.5281/zenodo.8126101-ad55d9?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAE9GlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9i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OwzOC/Bj4z+OMJY/QY3GRgYpYYjZAFwOcGXwTeAVqNvjsJ41iPgDZgSpZIFdICHAz0rSp9zjD6LiWMZWVkDDDNDygFPwLjDX4XQwKLRv9bQBfQnHOcAWCOwTcDz+B2zII0IRuBFQb/O/Bupm29Z/oyYbwQHs02YktrFrDD4O9SZh9UIzThMnK/EYNDAX4dcDExoBQUyIiAOCE/Ac8b/E7gu+SQ0nAdOJcl8s6R97BL5xywISKAk8AN3EMtFQLO4Krj30Eyj5DJuG/dwpLIIJaRtgRXRJ7SOhbg1+GW0hjf43KMl4RKGdkFTDf43cA3FWytJ3JqSS0COnBLbhH4B/gedygbgPJC1uC2Gj7O47JRCd0GNx84lcM2i3bgqMf1AvvJPKtCpdWO29VaeAX7YefDeje1JYedj0+8tnBL/elhcQTOAF2B88T7EeeIuQEfb0b4eMGwvyZ3SmzL3msZfxEIYG9EAIPXLwFf03PYTpB03rPrl3RU0jxJTeWEvBYY+HiCCCS1Srpt+OuT9EYZu1cl/WXY9UraJC8bkoZN9rXAV4E67Qf2YL+mKYeb2CfFVmAf8Gfp81fc6jMXdwyYbdgIt+ncB9we2TukansgG/WCIxrK8ogsZletwgiV9YNTwPLS31aGhwk5A/TVMJj9uLeYsdgJvIRVTll4KVpeo7K4LOmp0hiLJe2Wm/Dl0ClplV9Coct69zsHWIjL1mj/m6CAy3InbuudxXO4TecU3CJSKH3rPcBh3A9E+QcyhPwv8dD8htgQUm9oCKk3NITUG+4BHP2mwwGKgTwAAAAASUVORK5CYII=)](https://zenodo.org/badge/latestdoi/610509640)
[![License](https://img.shields.io/badge/license-MIT-red?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfoAwYAMwyp1T9YAAAJQ0lEQVRo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A6NTE6MDcrMDA6MDCKlVvxAAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDI0LTAzLTA2VDAwOjUxOjEyKzAwOjAwQxJVFwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=)](https://opensource.org/licenses/MIT)
![Banner](https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/img/banner.jpg)
</div>
## About
Package for processing images with different types of glasses and their parts. It provides a quick way to use the pre-trained models for **3** kinds of tasks, each divided into multiple categories, for instance, *classification of sunglasses* or *segmentation of glasses frames*.
<br>
<div align="center">
<table align="center"><tbody>
<tr><td><strong>Classification</string></td> <td> 👓 <em>transparent</em> 🕶️ <em>opaque</em> 🥽 <em>any</em> ➿<em>shadows</em></td></tr>
<tr><td><strong>Detection</string></td> <td> 🤓 <em>worn</em> 👓 <em>standalone</em> 👀 <em>eye-area</em></td></tr>
<tr><td><strong>Segmentation</string></td> <td> 😎 <em>full</em> 🖼️ <em>frames</em> 🦿 <em>legs</em> 🔍 <em>lenses</em> 👥 <em>shadows</em></td></tr>
</tbody></table>
$\color{gray}{\textit{Note: }\text{refer to}}$ [Glasses Detector Features](https://mantasu.github.io/glasses-detector/docs/features.html) $\color{gray}{\text{for visual examples.}}$
</div>
## Installation
> [!IMPORTANT]
> Minimum version of [Python 3.12](https://www.python.org/downloads/release/python-3120/) is required. Also, you may want to install [Pytorch](https://pytorch.org/get-started/locally/) (select *Nightly* for compatibility) in advance to select specific configuration for your device and environment.
### Pip Package
If you only need the library with pre-trained models, just install the [pip package](https://pypi.org/project/glasses-detector/) and see **Quick Start** for usage (also check [Glasses Detector Installation](https://mantasu.github.io/glasses-detector/docs/features.html) for more details):
```bash
pip install glasses-detector
```
You can also install it from the source:
```bash
git clone https://github.com/mantasu/glasses-detector
cd glasses-detector && pip install .
```
### Local Project
If you want to train your own models on the given datasets (or on some other datasets), just clone the project and install training requirements, then see **[Running](https://github.com/mantasu/glasses-detector?tab=readme-ov-file#running)** section to see how to run training and testing.
```bash
git clone https://github.com/mantasu/glasses-detector
cd glasses-detector && pip install -r requirements.txt
```
You can create a virtual environment for your packages via [venv](https://docs.python.org/3/library/venv.html), however, if you have conda, then you can simply use it to create a new environment, for example:
```bash
conda create -n glasses-detector python=3.12
conda activate glasses-detector
```
> To set-up the datasets, refer to **[Data](https://github.com/mantasu/glasses-detector?tab=readme-ov-file#data)** section.
## Quick Start
### Command Line
You can run predictions via the command line. For example, classification of a single image and segmentation of images inside a directory can be performed by running:
```bash
glasses-detector -i path/to/img.jpg -t classification -d cuda -f int # Prints 1 or 0
glasses-detector -i path/to/img_dir -t segmentation -f mask -e .jpg # Generates masks
```
> [!TIP]
> You can also specify things like `--output-path`, `--size`, `--batch-size` etc. Check the [Glasses Detector CLI](https://mantasu.github.io/glasses-detector/docs/cli.html) and [Command Line Examples](https://mantasu.github.io/glasses-detector/docs/examples.html#command-line) for more details.
### Python Script
You can import the package and its models via the python script for more flexibility. Here is an example of how to classify people wearing sunglasses:
```python
from glasses_detector import GlassesClassifier
# Generates a CSV with each line "<img_name.jpg>,<True|False>"
classifier = GlassesClassifier(size="small", kind="sunglasses")
classifier.process_dir("path/to/dir", "path/to/preds.csv", format="bool")
```
And here is a more efficient way to process a dir for detection task (only single bbox per image is currently supported):
```python
from glasses_detector import GlassesDetector
# Generates dir_preds with bboxes as .txt for each img
detector = GlassesDetector(kind="eyes", device="cuda")
detector.process_dir("path/to/dir", ext=".txt", batch_size=64)
```
> [!TIP]
> Again, there are a lot more things that can be specified, for instance, `output_size` and `pbar`. It is also possible to directly output the results or save them in a variable. See [Glasses Detector API](https://mantasu.github.io/glasses-detector/docs/api.html) and [Python Script Examples](https://mantasu.github.io/glasses-detector/docs/examples.html#python-script) for more details.
### Demo
Feel free to play around with some [demo image files](https://github.com/mantasu/glasses-detector/demo/). For example, after installing through [pip](https://pypi.org/project/glasses-detector/), you can run:
```bash
git clone https://github.com/mantasu/glasses-detector && cd glasses-detector/data
glasses-detector -i demo -o demo_labels.csv --task classification:eyeglasses
```
You can also check out the [demo notebook](https://github.com/mantasu/glasses-detector/notebooks/demo.ipynb) which can be also accessed via [Google Colab](https://colab.research.google.com/github/mantasu/glasses-detector/blob/master/notebooks/demo.ipynb).
## Credits
For references and citation, please see [Glasses Detector Credits](https://mantasu.github.io/glasses-detector/docs/credits.html).
Raw data
{
"_id": null,
"home_page": "https://github.com/mantasu/glasses-detector",
"name": "glasses-detector",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": "",
"keywords": "python,pytorch,torchvision,computer,vision,image,face,eyes,transparent,opaque,glasses,googles,spectacles,eyeglasses,sunglasses,frames,lenses,legs,shadows,binary,identification,identifier,classification,classifier,segmentation,segmenter,detection,detector,cuda,mps,gpu",
"author": "Mantas Bir\u0161kus",
"author_email": "mantix7@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/05/83/e516b2c3513848f16fa58b1597107718efb98e511c846f05e5356824847d/glasses-detector-1.0.1.tar.gz",
"platform": null,
"description": "\n<h1 align=\"center\"><img src=\"https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/img/logo-light.png\" width=27px height=27px> Glasses Detector</h1>\n\n<div align=\"center\">\n\n[![Colab](https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/svg/colab.svg)](https://colab.research.google.com/github/mantasu/glasses-detector/blob/main/notebooks/demo.ipynb)\n[![Docs](https://github.com/mantasu/glasses-detector/actions/workflows/sphinx.yaml/badge.svg)](https://mantasu.github.io/glasses-detector/)\n[![PyPI](https://img.shields.io/pypi/v/glasses-detector?color=yellow&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAsCAMAAAAQPRtoAAAB9VBMVEVHcEzY2Nnr6ufb2dDCxtDp6eXq6ufQz8rHycj5+vvo6OXm5d+9xctWfqDl5eTf393m5uPz8/Dbz6Zzkav40E/19fTu7u7f391Dcpnm5eOGnrJSha7vzmY7bJb00V9sjqr0yT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6BoRnA8IT1aECJwz0JZFqb3BUrFpA9laULaDx5qSyTmNxby8MzTsFOybCUZLwbiPhJrRoymLvNhv7g2/SriodVjSc/EiyOzi+TOjumJ8djF2zC3fykvhNTWhZ3yqpRk0foaAggms/Mi7ZfwoH/YPxSCnRLZ7pTKCIvmagjjluUawZ2Ssxwc8tAhtVPQtJGKlqwX5EyBrxYGCY47wuKQR+0UdfkaIV3R9eUMnwOElkjqU1AQyqsnd3wzK6scx+jiwyzlIIzfSEhXpbS5+mEslXLzRD3xNxLWxSbHlx/zQOmUOrIPFvZruZ4k15cfTwGOUec2EBhfCk8rnYIIic0GNle5sRQgtASkuO135HgbjoZzIZbPCxTlhZ0VjydXxlDgGgGpXOHlE6Wzzt4ISgpxDHlCkXQ+r3QK5vpljNAR98TdN6MWw7Urh1HuKkHHEpuJLsJO0RJA8K/f/j1qt9stBlHtFA1B8ZX0GsJwGfklAoiElU4p1xG2RgAocHKGY1ITNYK2SpwXpWYEgBwvv5Z5IpXSExyXREkURWcD4QsZmS8wAGy9fddAlK4UF2zw/VIJSd5ZychuOB0W9e6N/X0TAkf40e9/xWweGJ9cjL9Y+4NB3xQYP7U1+t+WSi6c1ROnmAj/uTQjeAPPN+ZH7Xdz2zsG+PcTKIvlyNEDHQZRT+AHJjG/tvHMglasEtgnMP7tn28pV1mXuc2hI2gElao1TyGYvlOfmqof4YOH9ot64ihrCeD4q6dO9OivvY5jx/dJLQjIXf2i+Q1hunwRFuhoIHzfZ63vIWMPjKUnT7QBWtyqKFaVXDjf1dO+h8sexQpDgk6gc69/FAbTNXOb+XLrn4n/AS3T2zxNRKClAAAAAElFTkSuQmCC)](https://pypi.org/project/glasses-detector/)\n[![Python](https://img.shields.io/badge/python-\u2265%203.12-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3L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0II7dHTtn5m4tJfmee8BhT3yeBJIiRJMynicOPo02B0x8qJwPip5osZ8yl330l1JMCX6GOpcxljlbUH+g8ifTNAnBRKQGEfaxd+XbU2CBxr4N6dAdKy7A29yG6Y7kS2t0ieVk1M49uK0260+/Ga1C2tJw0QC0cF1adq5gcI/oHVhtgpP7YglOHcJaQzH24hXkY7g6WVWDwzFbUUqyf8ASQ3KW+bpq4sAAAAASUVORK5CYII=)](https://docs.python.org/3/)\n[![CUDA](https://img.shields.io/badge/cuda-yes-5eb304?logo=nvidia)](https://developer.nvidia.com/cuda-toolkit)\n[![DOI](https://img.shields.io/badge/doi-10.5281/zenodo.8126101-ad55d9?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAE9GlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZWRhMmIzZmFjLCAyMDIxLzExLzE3LTE3OjIzOjE5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21t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Ff03PYTpB03rPrl3RU0jxJTeWEvBYY+HiCCCS1Srpt+OuT9EYZu1cl/WXY9UraJC8bkoZN9rXAV4E67Qf2YL+mKYeb2CfFVmAf8Gfp81fc6jMXdwyYbdgIt+ncB9we2TukansgG/WCIxrK8ogsZletwgiV9YNTwPLS31aGhwk5A/TVMJj9uLeYsdgJvIRVTll4KVpeo7K4LOmp0hiLJe2Wm/Dl0ClplV9Coct69zsHWIjL1mj/m6CAy3InbuudxXO4TecU3CJSKH3rPcBh3A9E+QcyhPwv8dD8htgQUm9oCKk3NITUG+4BHP2mwwGKgTwAAAAASUVORK5CYII=)](https://zenodo.org/badge/latestdoi/610509640)\n[![License](https://img.shields.io/badge/license-MIT-red?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfoAwYAMwyp1T9YAAAJQ0lEQVRo3sWaaWxU1xXHf2/zLMSAbUxsgj22QdixWRziJKjwIXVNgxwJmi8JfKkUUqlITSqqoipREqpIlRNlQ3Jpo5K0aVGU5ENSKUIswVGQJYelpNAGY1Nk18xSB483Anj2mdMPb97wGGw83uK/ZHnmzj33nd89993lvKcwO9KB5cAaoB64HygHCgFnuk4YGAF8QBfwL+AC8D8gOVMHlBnaLwd+CGwBGoD7gAU52AkQAgLAP4CjQDvQPzv9mrtqgN8B3Zi9KTP8SwCdwG+BldNxaKoRKQF+lv7zZP+4aNEiysrKqKqqoqysjOLiYtxuNyJCKBRicHAQn89HX18ffr+f69evj3eNXuAA8BdgaC6i8BhwMrs3Fy9eLFu2bJF9+/bJ6dOnJRgMSiwWk4kUi8VkYGBATp48KW+88YY0NTXJwoULx4tSO/DobAK4gN8Aw/YLLV26VHbt2iUdHR0SCoVkuhobG5P29nZ55plnpKioKBtmAPgl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69at2RCfYr6EMCVVASfsDW3YsEFOnDgxpwCpVEo+//xzWb9+fTbEUWz5henA3BaZ4uJi2bt3rwQCgVmH8Hq98vzzz0thYWE2xN+BsulCWCoB3sU2AQCybt06aW1tFZ/PN2OAvr4+eeutt6Suri4bIAL8HiiaKYQlF/ALzGcSmQspiiLV1dWye/duOXbsmPT390s8Hp/U8VgsJoFAQA4fPizPPvusrFy5crxM6X8x37DI6Rn7VE9BDwC/Bn5C1sszTqcTj8dDbW0t1dXVeDwelixZgsvlAiAUCjE0NITX66W7u5vu7m58Ph/RaDT7Gtcxb+q3se2h5kIOzOz9p5g75wnzz5qmiWEYYhiGqKo62Ys1w5j7vSamML1ONyLZQOsxnwL/CHOlXTiFNgX4DnOVbgMOYb7DFZuOM7N1wF4CrAM2YJ7/VwGlmG8qWAeMBOaw+Tbt/NfAKcyXz3JP30yg/wOnLmUjzQSuRAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyNC0wMy0wNlQwMDo1MTowNyswMDowMPvI400AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjQtMDMtMDZUMDA6NTE6MDcrMDA6MDCKlVvxAAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDI0LTAzLTA2VDAwOjUxOjEyKzAwOjAwQxJVFwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=)](https://opensource.org/licenses/MIT)\n\n![Banner](https://raw.githubusercontent.com/mantasu/glasses-detector/main/docs/_static/img/banner.jpg)\n\n</div>\n\n## About\n\nPackage for processing images with different types of glasses and their parts. It provides a quick way to use the pre-trained models for **3** kinds of tasks, each divided into multiple categories, for instance, *classification of sunglasses* or *segmentation of glasses frames*.\n\n<br>\n\n<div align=\"center\">\n\n<table align=\"center\"><tbody>\n <tr><td><strong>Classification</string></td> <td> \ud83d\udc53 <em>transparent</em> \ud83d\udd76\ufe0f <em>opaque</em> \ud83e\udd7d <em>any</em> \u27bf<em>shadows</em></td></tr>\n <tr><td><strong>Detection</string></td> <td> \ud83e\udd13 <em>worn</em> \ud83d\udc53 <em>standalone</em> \ud83d\udc40 <em>eye-area</em></td></tr>\n <tr><td><strong>Segmentation</string></td> <td> \ud83d\ude0e <em>full</em> \ud83d\uddbc\ufe0f <em>frames</em> \ud83e\uddbf <em>legs</em> \ud83d\udd0d <em>lenses</em> \ud83d\udc65 <em>shadows</em></td></tr>\n</tbody></table>\n\n$\\color{gray}{\\textit{Note: }\\text{refer to}}$ [Glasses Detector Features](https://mantasu.github.io/glasses-detector/docs/features.html) $\\color{gray}{\\text{for visual examples.}}$\n\n</div>\n\n## Installation\n\n> [!IMPORTANT]\n> Minimum version of [Python 3.12](https://www.python.org/downloads/release/python-3120/) is required. Also, you may want to install [Pytorch](https://pytorch.org/get-started/locally/) (select *Nightly* for compatibility) in advance to select specific configuration for your device and environment.\n\n### Pip Package\n\nIf you only need the library with pre-trained models, just install the [pip package](https://pypi.org/project/glasses-detector/) and see **Quick Start** for usage (also check [Glasses Detector Installation](https://mantasu.github.io/glasses-detector/docs/features.html) for more details):\n\n```bash\npip install glasses-detector\n```\n\nYou can also install it from the source:\n\n```bash\ngit clone https://github.com/mantasu/glasses-detector\ncd glasses-detector && pip install .\n```\n\n### Local Project\n\nIf you want to train your own models on the given datasets (or on some other datasets), just clone the project and install training requirements, then see **[Running](https://github.com/mantasu/glasses-detector?tab=readme-ov-file#running)** section to see how to run training and testing.\n\n```bash\ngit clone https://github.com/mantasu/glasses-detector\ncd glasses-detector && pip install -r requirements.txt\n```\n\nYou can create a virtual environment for your packages via [venv](https://docs.python.org/3/library/venv.html), however, if you have conda, then you can simply use it to create a new environment, for example:\n\n```bash\nconda create -n glasses-detector python=3.12\nconda activate glasses-detector \n```\n\n> To set-up the datasets, refer to **[Data](https://github.com/mantasu/glasses-detector?tab=readme-ov-file#data)** section.\n\n## Quick Start\n\n### Command Line\n\nYou can run predictions via the command line. For example, classification of a single image and segmentation of images inside a directory can be performed by running:\n\n```bash\nglasses-detector -i path/to/img.jpg -t classification -d cuda -f int # Prints 1 or 0\nglasses-detector -i path/to/img_dir -t segmentation -f mask -e .jpg # Generates masks\n```\n\n> [!TIP]\n> You can also specify things like `--output-path`, `--size`, `--batch-size` etc. Check the [Glasses Detector CLI](https://mantasu.github.io/glasses-detector/docs/cli.html) and [Command Line Examples](https://mantasu.github.io/glasses-detector/docs/examples.html#command-line) for more details.\n\n### Python Script\n\nYou can import the package and its models via the python script for more flexibility. Here is an example of how to classify people wearing sunglasses:\n\n```python\nfrom glasses_detector import GlassesClassifier\n\n# Generates a CSV with each line \"<img_name.jpg>,<True|False>\"\nclassifier = GlassesClassifier(size=\"small\", kind=\"sunglasses\")\nclassifier.process_dir(\"path/to/dir\", \"path/to/preds.csv\", format=\"bool\")\n```\n\nAnd here is a more efficient way to process a dir for detection task (only single bbox per image is currently supported):\n\n```python\nfrom glasses_detector import GlassesDetector\n\n# Generates dir_preds with bboxes as .txt for each img\ndetector = GlassesDetector(kind=\"eyes\", device=\"cuda\")\ndetector.process_dir(\"path/to/dir\", ext=\".txt\", batch_size=64)\n```\n\n> [!TIP]\n> Again, there are a lot more things that can be specified, for instance, `output_size` and `pbar`. It is also possible to directly output the results or save them in a variable. See [Glasses Detector API](https://mantasu.github.io/glasses-detector/docs/api.html) and [Python Script Examples](https://mantasu.github.io/glasses-detector/docs/examples.html#python-script) for more details.\n\n### Demo\n\nFeel free to play around with some [demo image files](https://github.com/mantasu/glasses-detector/demo/). For example, after installing through [pip](https://pypi.org/project/glasses-detector/), you can run:\n\n```bash\ngit clone https://github.com/mantasu/glasses-detector && cd glasses-detector/data\nglasses-detector -i demo -o demo_labels.csv --task classification:eyeglasses\n```\n\nYou can also check out the [demo notebook](https://github.com/mantasu/glasses-detector/notebooks/demo.ipynb) which can be also accessed via [Google Colab](https://colab.research.google.com/github/mantasu/glasses-detector/blob/master/notebooks/demo.ipynb).\n\n## Credits\n\nFor references and citation, please see [Glasses Detector Credits](https://mantasu.github.io/glasses-detector/docs/credits.html).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Glasses classification, detection, and segmentation.",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/mantasu/glasses-detector/issues",
"Documentation": "https://mantasu.github.io/glasses-detector",
"Homepage": "https://github.com/mantasu/glasses-detector"
},
"split_keywords": [
"python",
"pytorch",
"torchvision",
"computer",
"vision",
"image",
"face",
"eyes",
"transparent",
"opaque",
"glasses",
"googles",
"spectacles",
"eyeglasses",
"sunglasses",
"frames",
"lenses",
"legs",
"shadows",
"binary",
"identification",
"identifier",
"classification",
"classifier",
"segmentation",
"segmenter",
"detection",
"detector",
"cuda",
"mps",
"gpu"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4fef9814e49ca8297ecc1b408c095ec33126dae386259e83ef82f08db8c607a9",
"md5": "eacc6a6c28521ec5fa54c9a4f80bed7d",
"sha256": "adc7d49ca3bd4577195b554ff403ecb62410a811205e8bad67d6ceac1fe01954"
},
"downloads": -1,
"filename": "glasses_detector-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eacc6a6c28521ec5fa54c9a4f80bed7d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 73661,
"upload_time": "2024-03-06T07:17:01",
"upload_time_iso_8601": "2024-03-06T07:17:01.735787Z",
"url": "https://files.pythonhosted.org/packages/4f/ef/9814e49ca8297ecc1b408c095ec33126dae386259e83ef82f08db8c607a9/glasses_detector-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0583e516b2c3513848f16fa58b1597107718efb98e511c846f05e5356824847d",
"md5": "3a63380396e9346b1b25b1b96ab9d0d1",
"sha256": "3a03b653a5a255115db87f1d1b1ad452e0a0e1ecc96c88d37677b7bb45335272"
},
"downloads": -1,
"filename": "glasses-detector-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3a63380396e9346b1b25b1b96ab9d0d1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 87590,
"upload_time": "2024-03-06T07:17:04",
"upload_time_iso_8601": "2024-03-06T07:17:04.513162Z",
"url": "https://files.pythonhosted.org/packages/05/83/e516b2c3513848f16fa58b1597107718efb98e511c846f05e5356824847d/glasses-detector-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-06 07:17:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mantasu",
"github_project": "glasses-detector",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "glasses-detector"
}