MCPcopy Create free account

hub / github.com/SamSamhuns/face_registration_and_recognition_milvus / functions

Functions127 in github.com/SamSamhuns/face_registration_and_recognition_milvus

↓ 10 callersFunctionmock_person_data_dict
returns a func to create a person_data dict for testing
face_reg_recog_milvus/tests/conftest.py:148
↓ 6 callersFunctionprint_clf_train_test_acc
Preds and prints the acc of a sklearn clsf
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:246
↓ 5 callersFunctionensure_connections
()
face_reg_recog_milvus/app/inference.py:117
↓ 4 callersFunction_load_file_content
Load file from fpath and return as bytes
face_reg_recog_milvus/tests/conftest.py:50
↓ 4 callersFunctionget_mode_ext
Returns the file extension for the given mode. Args: mode (str): Either "image" or "video". Returns: str: The file extens
face_reg_recog_milvus/app/utils/common.py:11
↓ 4 callersFunctionrun_inference
Note: only one image is assumed for inference Returns a dict with params status and message along with optionally other parameters status
face_reg_recog_milvus/app/triton_server/inference_trtserver.py:78
↓ 3 callersFunction_retry
(action, label: str, retries: int = 10, delay: float = 1.0, backoff: float = 1.5)
face_reg_recog_milvus/app/inference.py:54
↓ 3 callersFunctionget_milvus_collec_conn
Gets the milvus collection connection with the given collection name otherwise creates a new one Note: index_metric_params: dict = {"nlist":
face_reg_recog_milvus/app/api/milvus.py:12
↓ 3 callersFunctioninsert_person_data_into_sql
Insert person_data into mysql table with param binding Note: the transaction must be committed after if commit is False
face_reg_recog_milvus/app/api/mysql.py:12
↓ 3 callersMethodrun
run func and get results as dict
face_reg_recog_milvus/app/routes/register_person.py:34
↓ 2 callersMethod_shared_eval_step
(self, batch, batch_idx)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:93
↓ 2 callersMethod_shared_eval_step
(self, batch, batch_idx)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:150
↓ 2 callersFunctioncache_file_locally
Caches the given data to a local file. Args: file_cache_path (str): The path to save the data. data (bytes): The data to cach
face_reg_recog_milvus/app/utils/common.py:52
↓ 2 callersFunctiondelete_person_data_from_sql_with_id
Delete record from mysql db using the uniq person_id
face_reg_recog_milvus/app/api/mysql.py:85
↓ 2 callersFunctiondownload_url_file
Downloads the file at the given URL to the local path using requests library. This version uses streaming to handle large files and includes
face_reg_recog_milvus/app/utils/common.py:32
↓ 2 callersMethodget_encrypted_vector_bytes
Encrypts & returns vector obj
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:74
↓ 2 callersFunctionget_registered_person
Get registered person by person_id. Checks redis cache, otherwise query mysql
face_reg_recog_milvus/app/inference.py:147
↓ 2 callersFunctionl2_dist_sq_ctxt
Calculates the encrypted squared l2 norm between encrypted vectors vec_1 and vec_2
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:46
↓ 2 callersFunctionmock_download_url_file
Creates a mock for download_url_file that uses local file content
face_reg_recog_milvus/tests/conftest.py:60
↓ 2 callersFunctionpoetry_to_pip
(name: str, constraint: str)
face_reg_recog_milvus/scripts/poetry_to_pip_requirements.py:7
↓ 2 callersMethodrun
run func and get results as dict
face_reg_recog_milvus/app/routes/recognize_person.py:34
↓ 2 callersFunctionselect_all_person_data_from_sql
Query mysql db to get all person data
face_reg_recog_milvus/app/api/mysql.py:62
↓ 2 callersFunctionselect_person_data_from_sql_with_id
Query mysql db to get full person data using the uniq person_id
face_reg_recog_milvus/app/api/mysql.py:38
↓ 2 callersFunctionunison_shuffled_copies
Shuffle two numpy arrays in unison
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:43
↓ 1 callersMethod__init__
(self, num_classes: int = 2, freeze_backbone: bool = False, **kwargs: Any)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:57
↓ 1 callersFunctionclip_coords
Clip bounding xyxy bounding boxes to image shape (height, width)
face_reg_recog_milvus/app/utils/image.py:38
↓ 1 callersMethodconnec_to_client
Connects to client HE public context. client_public_context is a dict with attributes {s_context, s_public_key, s_relin_key, s_rotate
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:96
↓ 1 callersFunctiondraw_bbox_on_image
Draw bboxes on cv2 image boxes must be 2D list/np array of coords xmin, ymin, xmax, ymax foreach bbox confs must be 2D list of co
face_reg_recog_milvus/app/utils/image.py:92
↓ 1 callersFunctionextract_data_from_media
Extracts input data from media files for inference. Args: FLAGS: The configuration parameters. preprocess_func: The preproces
face_reg_recog_milvus/app/utils/trtserver.py:156
↓ 1 callersFunctionface_embedding_extractor_iter
function that yields face_vectors as an iterator from an img_dir
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:114
↓ 1 callersFunctiongen_int_id
Get a unique int uuid
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:75
↓ 1 callersMethodget_all_vector_distances
Computes the squared l2-dist of vector repr by s_ctx to all vectors in existing vector db And returns a list of bytes of the encrypte
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:115
↓ 1 callersFunctionget_application
Gets FastAPI application object with CORS enabled.
face_reg_recog_milvus/app/server.py:34
↓ 1 callersFunctionget_client_and_model_metadata_config
Creates a Triton Inference Server client and retrieves model metadata and configuration. Args: FLAGS: The configuration parameters.
face_reg_recog_milvus/app/utils/trtserver.py:52
↓ 1 callersFunctionget_facenet_emb
Get the embedding vector from a facenet model output
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:80
↓ 1 callersFunctionget_inference_responses
Performs inference using the Triton Inference Server and returns the responses. Args: image_data_list: The list of input data.
face_reg_recog_milvus/app/utils/trtserver.py:190
↓ 1 callersMethodget_knn
Get the k nearest neighbors from the dist list i.e. take the min-k dist values and get the respective vectors in vector db
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:132
↓ 1 callersFunctionget_pyfhel_obj
Returns a Pyfhel encryption/decryption object
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:21
↓ 1 callersFunctionget_registered_person_milvus
Get registered data record by person_id. Arguments: person_id: int = number, output_fields: list[str] = ["person_id", "embedd
face_reg_recog_milvus/app/api/milvus.py:53
↓ 1 callersFunctioninit_connections
Initialize Redis/MySQL/Milvus connections with retry/backoff. Safe to call multiple times.
face_reg_recog_milvus/app/inference.py:102
↓ 1 callersFunctioninsert_data_into_mysql
Inserts data in bulk into mysql Each data should match the data model in PersonModel app/models/model.py
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:152
↓ 1 callersFunctionmain
Demo inference run
face_reg_recog_milvus/app/triton_server/inference_trtserver.py:200
↓ 1 callersFunctionmain
Main function, the img dir containing face images should be passed into the insert_data functions
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:178
↓ 1 callersFunctionpad_resize_image
resize and pad image with color if necessary, maintaining orig scale args: cv2_img: numpy.ndarray = cv2 image new_size: tuple
face_reg_recog_milvus/app/utils/image.py:11
↓ 1 callersFunctionparse_model_grpc
Parses the model metadata and configuration to extract necessary information for inference. Args: model_metadata: The model metadata.
face_reg_recog_milvus/app/utils/trtserver.py:114
↓ 1 callersFunctionpostprocess
Postprocess detections & face features from triton-server Args: results: triton server inference result orig_img_size: (width
face_reg_recog_milvus/app/triton_server/inference_trtserver.py:41
↓ 1 callersMethodregister_vector
Register encrypted vector into database. Server must be connected to client first
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:107
↓ 1 callersFunctionrequestGenerator
Generates inference requests for the Triton Inference Server. Args: input_data_list: The list of input data. input_name_list:
face_reg_recog_milvus/app/utils/trtserver.py:86
↓ 1 callersFunctionscale_coords
Rescale coords (xyxy) from img1_shape to img0_shape img1_shape: (h,w) model input shape img0_shape: (h,w) orig image shape
face_reg_recog_milvus/app/utils/image.py:48
↓ 1 callersFunctiontrain_faces_with_cnn
Train faces from train and test directories with real & fake face images
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:170
↓ 1 callersFunctiontrain_vectors_with_dnn
Use a DNN with pytorch lightining to classify face vectors
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:204
↓ 1 callersFunctiontrain_vectors_with_sklearn_clsf
Train and eval svm, random forests & adaboost classifiers
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:241
Method__init__
(self)
face_reg_recog_milvus/app/utils/trtserver.py:19
Method__init__
(self, func, input_data)
face_reg_recog_milvus/app/routes/recognize_person.py:28
Method__init__
(self, func, input_data)
face_reg_recog_milvus/app/routes/register_person.py:28
Method__init__
(self, context_params: dict)
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:60
Method__init__
(self)
face_reg_recog_milvus/scripts/homomorphic_emb_face_search_knn.py:91
Method__init__
Init model feature extractor backbone and final NN classifier
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:121
Function_connect_milvus
()
face_reg_recog_milvus/app/inference.py:88
Function_connect_mysql
()
face_reg_recog_milvus/app/inference.py:73
Function_connect_redis
()
face_reg_recog_milvus/app/inference.py:67
Function_gen_data
(person_id: int = -1)
face_reg_recog_milvus/tests/conftest.py:153
Functionadd_process_time_header
Adds an X-Process-Time header to the response indicating the api request processing time.
face_reg_recog_milvus/app/server.py:55
Functionclose_connections
(disconnect_milvus: bool = True)
face_reg_recog_milvus/app/inference.py:122
Methodconfigure_optimizers
(self)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:82
Methodconfigure_optimizers
(self)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:140
Functioncreate_mock
(file_content)
face_reg_recog_milvus/tests/conftest.py:65
Functionfavicon
Favicon endpoint. Returns the favicon.
face_reg_recog_milvus/app/server.py:77
Methodforward
(self, x)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:77
Methodforward
(self, x: torch.Tensor)
face_reg_recog_milvus/scripts/train_spoofed_face_vector_clsf.py:136
Functionget_all_registered_person
Get all registered persons query mysql
face_reg_recog_milvus/app/inference.py:168
Functionget_all_registered_persons
Gets all registered persons.
face_reg_recog_milvus/app/routes/person.py:21
Functionget_registered_person
Gets the registered person with the given ID.
face_reg_recog_milvus/app/routes/person.py:33
Functionhealth_check
Health check endpoint to verify server is running.
face_reg_recog_milvus/app/server.py:71
Functionindex
Root endpoint. Returns a welcome message.
face_reg_recog_milvus/app/server.py:65
Functioninsert_embeddings_into_milvus_towhee
reference nb: https://github.com/towhee-io/examples/blob/main/image/reverse_image_search/1_build_image_search_engine.ipynb
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:61
Functioninsert_embeddings_into_milvus_trt_sever
Inserts embeddings data in bulk into milvus
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:141
Functionlifespan
(app: FastAPI)
face_reg_recog_milvus/app/server.py:26
Functionload_image
Yield image paths
face_reg_recog_milvus/scripts/bulk_insert_faces_into_milvus.py:69
Functionmock_download
(url, path)
face_reg_recog_milvus/tests/conftest.py:66
Functionmock_no_face_image
load and return an image with a single face
face_reg_recog_milvus/tests/conftest.py:212
Functionmock_one_face_image_1_file
load and return an image with a single face
face_reg_recog_milvus/tests/conftest.py:169
Functionmock_one_face_image_1_url
returns an image url with a single face
face_reg_recog_milvus/tests/conftest.py:187
Functionmock_one_face_image_2_file
load and return an image with a single face
face_reg_recog_milvus/tests/conftest.py:178
Functionmock_one_face_image_2_url
returns an image url with a single face
face_reg_recog_milvus/tests/conftest.py:195
Functionmock_two_face_image
load and return an image with a single face
face_reg_recog_milvus/tests/conftest.py:203
Functionplot_one_box
Plot one bounding box on image img args bboxes: bounding boxes in xyxy format (x1,y1,x2,y2) img: image in (H,W,C) numpy.ndarr
face_reg_recog_milvus/app/utils/image.py:156
Functionpreprocess
Preprocess input cv2 image Args: img: cv2 input image width: model input width height: model input height new
face_reg_recog_milvus/app/triton_server/inference_trtserver.py:25
Functionrecognize_person
Detects faces in image from the file_path and finds the most similar face vector from a set of saved face vectors
face_reg_recog_milvus/app/inference.py:276
Functionrecognize_person_file
recognize person from the face image file uploaded as a file
face_reg_recog_milvus/app/routes/recognize_person.py:46
Functionrecognize_person_url
recognize person from the face image file provided as a url
face_reg_recog_milvus/app/routes/recognize_person.py:72
Functionregister_person
Detects faces in image from the file_path and saves the face feature vector & the related person_data dict. person_data dict should be ba
face_reg_recog_milvus/app/inference.py:209
Functionregister_person_file
registers person face and info with the face uploaded as an image file Person data id: int = must be a unique id in the database, re
face_reg_recog_milvus/app/routes/register_person.py:46
Functionregister_person_url
registers person face and info with the face image file provided as a url Person data id: int = must be a unique id in the database,
face_reg_recog_milvus/app/routes/register_person.py:85
Functionremove_file
Removes the file at the given path. Args: path (str): The path of the file to remove.
face_reg_recog_milvus/app/utils/common.py:22
Functionresize_maintaining_aspect
Resizes an image while maintaining aspect ratio. If width and height are both None, no resize is done. If either width or height is None,
face_reg_recog_milvus/app/utils/trtserver.py:23
Functionresize_maintaining_aspect
If width and height are both None, no resize is done If either width or height is None, resize maintaining aspect
face_reg_recog_milvus/app/utils/image.py:180
Functiontest_app_asyncio
Sets up the async server for httpx>=20, follow_redirects=True (cf. https://github.com/encode/httpx/releases/tag/0.20.0)
face_reg_recog_milvus/tests/conftest.py:76
Functiontest_delete_person_milvus
Deletes the test person from Milvus. Should call milvus_collec_conn.flush() and milvus_collec_conn.compact(collec_name) after deletion
face_reg_recog_milvus/tests/api/test_milvus_api.py:33
Functiontest_delete_person_mysql
Deletes test person data from MySQL database.
face_reg_recog_milvus/tests/api/test_mysql_api.py:45
next →1–100 of 127, ranked by callers