Skip to content

Commit

Permalink
Move library into own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Jun 13, 2024
1 parent c2221a5 commit fe8f8f2
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ See `help(MTCNN)` and `help(InceptionResnetV1)` for usage and implementation det

## Pretrained models

See: [models/inception_resnet_v1.py](models/inception_resnet_v1.py)
See: [models/inception_resnet_v1.py](facenet_pytorch/models/inception_resnet_v1.py)

The following models have been ported to pytorch (with links to download pytorch state_dict's):
Expand Down Expand Up @@ -193,7 +193,7 @@ Alternatively, the code can be installed as a package using pip:
## Conversion of parameters from Tensorflow to Pytorch
See: [models/utils/tensorflow2pytorch.py](models/tensorflow2pytorch.py)
See: [models/utils/tensorflow2pytorch.py](facenet_pytorch/models/tensorflow2pytorch.py)
Note that this functionality is not needed to use the models in this repo, which depend only on the saved pytorch `state_dict`'s.
Expand Down
4 changes: 2 additions & 2 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ img_probs = resnet(img_cropped.unsqueeze(0))

## 预训练模型

请参阅:[models/inception_resnet_v1.py](models/inception_resnet_v1.py)
请参阅:[models/inception_resnet_v1.py](facenet_pytorch/models/inception_resnet_v1.py)

以下模型已移植到 pytorch(包含下载 pytorch state_dict 的链接):

Expand Down Expand Up @@ -233,7 +233,7 @@ docker run --rm -p 8888:8888

## Tensorflow 到 Pytorch 的参数转换

请参阅:[models/utils/tensorflow2pytorch.py](models/tensorflow2pytorch.py)
请参阅:[models/utils/tensorflow2pytorch.py](facenet_pytorch/models/tensorflow2pytorch.py)

请注意,使用此存储库中的模型不需要此功能,该功能仅依赖于pytorch保存的 `state_dict`

Expand Down
12 changes: 0 additions & 12 deletions __init__.py

This file was deleted.

14 changes: 14 additions & 0 deletions facenet_pytorch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import warnings

from facenet_pytorch.models.inception_resnet_v1 import InceptionResnetV1
from facenet_pytorch.models.mtcnn import MTCNN, ONet, PNet, RNet, fixed_image_standardization, prewhiten
from facenet_pytorch.models.utils import training
from facenet_pytorch.models.utils.detect_face import extract_face

__all__ = ["InceptionResnetV1", "MTCNN", "ONet", "PNet", "RNet", "fixed_image_standardization", "prewhiten", "training", "extract_face"]

warnings.filterwarnings(
action="ignore",
message="This overload of nonzero is deprecated:\n\tnonzero()",
category=UserWarning,
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import json
import os
import sys

import tensorflow as tf
import torch

from dependencies.facenet.src import facenet
from dependencies.facenet.src.align import detect_face
from dependencies.facenet.src.models import inception_resnet_v1 as tf_mdl
from models.inception_resnet_v1 import InceptionResnetV1
from facenet_pytorch.models.inception_resnet_v1 import InceptionResnetV1
from models.mtcnn import ONet, PNet, RNet


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"facenet_pytorch.models.utils",
"facenet_pytorch.data",
],
package_dir={"facenet_pytorch": "."},
package_dir={"facenet_pytorch.data": "data"},
package_data={"": ["*net.pt"]},
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
5 changes: 2 additions & 3 deletions tests/actions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
import pandas as pd
import torch
from PIL import Image, ImageDraw
from torch.utils.data import DataLoader
from torchvision import datasets, transforms

from models.inception_resnet_v1 import InceptionResnetV1, get_torch_home
from models.mtcnn import MTCNN, fixed_image_standardization
from facenet_pytorch.models.inception_resnet_v1 import InceptionResnetV1, get_torch_home
from facenet_pytorch.models.mtcnn import MTCNN, fixed_image_standardization

#### CLEAR ALL OUTPUT FILES ####

Expand Down

0 comments on commit fe8f8f2

Please sign in to comment.