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

Commit

Permalink
Docs: update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
asheswook committed May 29, 2023
1 parent 808c27e commit b7d2452
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 16 deletions.
42 changes: 31 additions & 11 deletions README-Korean.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

[English](README.md) | **한국어**

사진에서 얼굴을 감지하고 준지도 학습 (반지도 학습)을 통해서 모델을 훈련시키고, 얼굴을 분류합니다.
사진에서 얼굴을 감지하고 준지도 학습 (반지도 학습)을 통해서 모델을 학습시키고, 얼굴을 분류합니다.

## Feature

- 사진에서 얼굴을 인식합니다.
- 준지도 학습을 통해 라벨링된 사진과 라벨링되지 않은 사진으로 모델을 훈련시킬 수 있습니다.
- 준지도 학습을 통해 라벨링된 사진과 라벨링되지 않은 사진으로 모델을 학습시킬 수 있습니다.
- 해당하는 얼굴이 모르는 사람의 얼굴인지, 아는 사람이라면 누구인지를 예측합니다.

## Installation
Expand Down Expand Up @@ -52,7 +52,7 @@ people = {
}
```

훈련에 사용할 사진 파일을 디렉토리에 넣어야 합니다. 이 때 파일 이름은 다음과 같은 규칙을 따릅니다:
학습에 사용할 사진 파일을 디렉토리에 넣어야 합니다. 이 때 파일 이름은 다음과 같은 규칙을 따릅니다:

`(NameLabel)-(아무 글자).확장자`

Expand All @@ -63,15 +63,21 @@ people = {
> Jerry-3.png<br>
> Jerry-4.png<br>
**얼굴을 인식하고 모델을 훈련시키기**
**얼굴을 인식하고 모델을 학습시키기**

디렉토리에 있는 사진 파일을 통해 모델을 훈련시킵니다.
학습하기 전에, 먼저 모델을 불러와야합니다. 모델이 없다구요? 상관 없습니다. 모델이 모델 디렉토리에 존재하지 않으면 자동으로 새로운 모델을 생성합니다.

```python
vs.load_model()
```

이제 디렉토리에 있는 사진 파일을 통해 모델을 학습시킵니다.

```
vs.train_labeled_data()
```

만약 라벨링되지 않은 사진 파일로 모델을 훈련시키고 싶다면 다음과 같이 할 수 있습니다.
만약 라벨링되지 않은 사진 파일로 모델을 학습시키고 싶다면 다음과 같이 할 수 있습니다.

```
vs.train_unlabeled_data()
Expand All @@ -97,16 +103,24 @@ print(result)
}
```

**전체 코드**

[예제 전체 코드](tests/test.py)

---

**디렉토리 설정**

사진 파일들은 설정된 디렉토리에 있어야 합니다. 또한 모델 파일도 설정된 모델 디렉토리에 저장되고 로드됩니다. 다음과 같이 디렉토리를 설정할 수 있습니다.

```python
vs.set_directory({
"labeled": "labeled_pic",
"unlabeled": "unlabeled_pic",
"model": "my_model.d"
})
from VisageSnap import Directory

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

_기본 디렉토리:_
Expand Down Expand Up @@ -140,6 +154,12 @@ encodings: NDArray = face_tom.encodings
filenames: list = face_tom.filenames
```

**결정 임계값 (threshold) 변경하기**

```python
vs.threshold = 0.5 # Default: 0.48
```

## Acknowledgement

- [scikit-learn](https://scikit-learn.org/stable/)
Expand Down
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ Put the picture files to be used during training in the directory. In this case,
**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.

```python
vs.load_model()
```

Train with the picture files in the directory.

```
Expand Down Expand Up @@ -95,16 +102,24 @@ print(result)
}
```

**Full example**

You can see the full code [here](tests/test.py).

---

**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.

```python
vs.set_directory({
"labeled": "labeled_pic",
"unlabeled": "unlabeled_pic",
"model": "my_model.d"
})
from VisageSnap import Directory

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

_Default Directory:_
Expand Down Expand Up @@ -138,6 +153,12 @@ encodings: NDArray = face_tom.encodings
filenames: list = face_tom.filenames
```

**To change prediction threshold**

```python
vs.threshold = 0.5 # Default: 0.48
```

## Acknowledgement

- [scikit-learn](https://scikit-learn.org/stable/)
Expand Down

0 comments on commit b7d2452

Please sign in to comment.