Skip to main content

VisageSnap

Release build

English | 한국어

Recognizes faces and trains models, brings in the pictures and provides identification predictions and face classification. It also performs semi-supervised learning.

Feature

  • Recognize faces.
  • Train the model through semi-supervised learning with labeled or unlabeled pictures.
  • Predicts if the face belongs to someone it knows and whose face it is.

Installation

Requirements

  • Python 3.9+
    • Versions below 3.9 have not been tested, and pickle module must be installed via pip.
  • dilb

First, you need to install dilb. You can install it by following the instructions on the here.

Then, you can install VisageSnap by using pip:

pip install visagesnap

Usage

Assign a label to the face

You should assign a NameLabel to the face you want to classify first.

vs = VisageSnap.Core()
people = ['Tom', 'Jerry']
# ['NameLabel1', 'NameLabel2', 'NameLabel3'...]

vs.set_label(people)

You can also do it like this so that assign a NameLabel and NumberLabel: (NumberLabel MUST NOT BE -1)

people = {
    # 'NameLabel': NumberLabel
    'Tom': 0,
    'Jerry': 1
}

Put the picture files to be used during training in the directory. In this case, the file name follows the following rules:

(NameLabel)-(Any character).extension

Tom-123.png
Tom-124.jpg
Tom-126.jpeg
Jerry-2.png
Jerry-3.png
Jerry-4.png

Recognize faces and train the model

Before training, you need to load model. You don't have a model? It's okay. It'll be created automatically if it doesn't exist.

vs.load_model()

Train with the picture files in the directory.

vs.train_labeled_data()

If you want to train with unlabeled data, you can also try to like this:

vs.train_unlabeled_data()

Identification predictions

Put the picture files you want to predict into the directory.

result = vs.predict_all()
print(result)
{
   "target1.png": "Tom",
   "target2.jpeg": "Jerry",
   "target3.jpeg": ["Tom", "Jerry"], # multiple faces in one picture
   "target4.jpeg": None # If the face is unknown
}

Full example

You can see the full code here.


To change the directory you work with

You should put the picture files into configured directory, and also model file is stored in model directory.

from VisageSnap import Directory

my_dir = Directory( "labeled_pic",
                    "unlabeled_pic",
                    "my_model.d",
                    "predict_dir")
vs.set_directory(my_dir)

Default Directory:

{
    "labeled": "labeled",
    "unlabeled": "unlabeled",
    "model": "model"
}

Others

To get the face information

You can get the faceObject by using get_faceObject method. The faceObject is a dataclass that contains the face information.

from visagesnap import From
# From.LABEL, From.FILENAME
face_tom = vs.get_faceObject(From.LABEL, "Tom")
face_tom = vs.get_faceObject(From.FILENAME, "Tom-123.png")
# face_tom = Face(label, encodings, filenames)

name: str = face_tom.label
encodings: NDArray = face_tom.encodings
filenames: list = face_tom.filenames

To change prediction threshold

vs.threshold = 0.5  # Default: 0.48

Acknowledgement

Metadata

Release files for VisageSnap 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VisageSnap 0.3.2
File Size Uploaded
VisageSnap-0.3.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for VisageSnap 0.3.2
File Interpreter ABI Platform
VisageSnap-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / VisageSnap-0.3.2.tar.gz

Download URL VisageSnap-0.3.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4cce90c4d83ba5c3dcf960c295d4a46bc8b3620e2a24e1f85133cd9203a8e638
BLAKE2b-256 checksum
How to use checksums
659243f1dee5756539fa0eda4c499ac519c845e03b2cb4a5fb840ccb5402be48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / VisageSnap-0.3.2-py3-none-any.whl

Download URL VisageSnap-0.3.2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d323ba16efc22529833cbaef6afbbb40d11fd6f24616dc7f23b0e17dcf6d1b72
BLAKE2b-256 checksum
How to use checksums
ccd33e8e2959f466b8a0114efacf1d588a92ba6e3c4d79653be3b2ecf3fee89c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page