Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Feat(set_label): be able to set label with list
Browse files Browse the repository at this point in the history
  • Loading branch information
asheswook committed Feb 19, 2023
1 parent a738686 commit 3679aa8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions FaceFlow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,36 @@ def convert_labelType(self, value, to: str):
return self.label.get(value, -1)
return None

def set_label(self, label: dict):
def set_label(self, person):
"""
This function sets the label dictionary.
Parameters
----------
label (dict) : label dictionary.
person (list or dict) : label list or dictionary.
Example
-------
label = {
person = ["name1", "name2", "name3", ...]
OR
person = {
"name1": 0,
"name2": 1,
"name3": 2,
...
}
- name1, name2, name3, ... : name of the person
- 0, 1, 2, ... : number label (MUST NOT BE -1)
"""
self.label = label

if type(person) == dict:
self.label = person
elif type(person) == list:
for i in range(len(person)):
self.label[person[i]] = i

def set_directory(self, dict: dict):
"""
Expand Down

0 comments on commit 3679aa8

Please sign in to comment.