Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init commit with face recgnition pipeline #2293

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

leo-q8
Copy link
Collaborator

@leo-q8 leo-q8 commented Oct 21, 2024

No description provided.

Copy link

paddle-bot bot commented Oct 21, 2024

Thanks for your contribution!

mode: check_dataset # check_dataset/train/evaluate/predict
dataset_dir: "/paddle/dataset/paddlex/det/widerface_coco_examples"
device: gpu:0,1,2,3
output: "output/blazeface"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

统一为output吧 文档默认路径都是output

Global:
model: IResNet50
mode: check_dataset # check_dataset/train/evaluate/predict
dataset_dir: "/paddle/dataset/paddlex/cls/cls_flowers_examples"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

人脸识别数据格式和这个不一样吧,建一个人脸识别demo数据集

log_interval: 1

Export:
weight_path: https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/foundation_models/CLIP_vit_base_patch16_224_ft_in1k_pretrained.pdparams
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

预训练模型是CLIP不对吧,这个换成你训练好的这个算法的人脸识别模型

val_percent: null

Train:
num_classes: 93431
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类别数量需要和你上面建立的数据集的类别数量一致

@@ -0,0 +1,41 @@
Global:
model: IResNet50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

算法名称需要和配置文件的文件名一致。文件名就叫做 IResNet50.yaml即可

batch_size: 128
drop_last: False
shuffle: True
#sample_method: "id_avg_prob"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释不要的删除

num_workers: 4
use_shared_memory: True

# Infer:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infer是需要配置的 不然导出有问题

@@ -258,6 +258,7 @@
"RT-DETR-H_layout_3cls": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/RT-DETR-H_layout_3cls_infer.tar",
"RT-DETR-H_layout_17cls": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/RT-DETR-H_layout_17cls_infer.tar",
"PicoDet_LCNet_x2_5_face": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/PicoDet_LCNet_x2_5_face_infer.tar",
"BlazeFace": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/BlazeFace_infer.tar"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

识别的模型也需要填写上

# limitations under the License.

import numpy as np
from paddlex.inference.components import CropByBoxes, FaissIndexer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

都改成相对的吧

import numpy as np

from paddlex.utils.func_register import FuncRegister
from paddlex.modules.face_recognition.model_list import MODELS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

相对路径比如 from ...utils.func_register import FuncRegister

dtype = (
np.uint8 if self._metric_type in self.BINARY_METRIC_TYPE else np.float32
)
features = np.array(features).astype(dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要取平均呢?

pickle.dump(ids, fd)


def get_file_list(data_file, root_dir, delimiter="\t"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建库的文件组织方式和这个是不同的吧

@leo-q8 leo-q8 force-pushed the face_rec branch 4 times, most recently from f7a1c02 to acaaa64 Compare October 22, 2024 14:02
super().__init__(device, predictor_kwargs)
self._build_predictor(det_model, rec_model)
self.set_predictor(det_batch_size, rec_batch_size, device)
self._indexer = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里加个is_build的参数吧,如果is_build=True 就调用self.build_index()建库,库保存在index_dir,如果是false相当于用户有自己的库,就传入index_dir就可以。

det_batch_size=1,
rec_batch_size=1,
index_dir=None,
metric_type="IP",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认是L2还是IP?

batch_size: 4
learning_rate: 0.001
pretrain_weight_path: null
warmup_steps: 500
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一共1000iter,warmup 500?

@@ -0,0 +1,41 @@
Global:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个模型要下掉吧?

CheckDataset:
convert:
enable: False
src_dataset_ype: null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type?


MODELS = [
"MobileFaceNet",
"IResnet50"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里名字又没对上

self.train_config.pretrain_weight_path
)

label_dict_path = Path(self.global_config.dataset_dir).joinpath("label.txt")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你的数据集还是否需要label.txt

name: Momentum
momentum: 0.9
lr:
name: Piecewise
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议直接cosine梭哈

Train:
dataset:
name: ImageNetDataset
image_root: dataset/MS1M_v3/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的root不对吧

epochs: 25
print_batch_step: 20
use_visualdl: False
eval_mode: face_recognition
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下边这些参数不应该在global中,应该放到Eval中

Global:
model: IResNet50
mode: check_dataset # check_dataset/train/evaluate/predict
dataset_dir: "/paddle/dataset/paddlex/cls/face_train_examples"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

face_rec_examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants