## 3 Methodology
### System Model  
The proposed system, shown in Figure 2, is organized into three main modules: training an object detection model, registering the animal, and identifying the animal. The first module involves the development of a model to detect the faces and noses of animals, which is necessary in automating the extraction of the animal's nose. The second module involves the registration of the animal in the system through the use of a unique tag or serial number. The third module is responsible for the recognition or identification of the animal. The first module of the system involves training an object detection model to detect the faces and noses of animals. This is achieved by processing unstructured data, which includes annotating and splitting the data into training and testing sets. The data are then fed to a Yolo (You Only Look Once) model, which is a type of convolutional neural network (CNN) designed for object detection. The Yolo model uses pre-trained weights, which are a set of parameters that have been previously trained on a large dataset, and bounding boxes to perform deep transfer learning. Deep transfer learning is a method of training a model on a new dataset by using the knowledge gained from a similar dataset. In this case, the Yolo model is able to use its knowledge of bounding boxes to detect the faces and noses of animals in the new dataset. Figure 2: Architecture of Proposed System. The second module of the system is responsible for registering animals in the system by associating them with a unique tag or serial number. This can be performed in real time or using a prerecorded video or image of the animal. A Rest-API (Application Programming Interface) using FastAPI is developed for this purpose, and an API request with the animal's tag is posted to register the animal. The API takes a video or image of the animal and processes it through the Yolo object detector to detect the face and nose of the animal. Once the face and nose are detected, the nose image is extracted and processed using histogram equalization and SIFT to extract keypoints and descriptors. These keypoints and descriptors are used to describe the unique features of the animal's nose, and they are stored in a cloud storage system along with the animal's identity information. The third module of the system is used for the identification of the animal. When an API request is made with an image or real-time video stream of the animal, the nose of the animal is extracted in the same way as in the second module. The extracted features and descriptors are then matched using approximate nearest neighbor search with the FLANN algorithm. FLANN is a high-performance algorithm that utilizes two algorithms--the randomized kd-tree algorithm and the hierarchical k-means tree algorithm--to perform approximate nearest neighbor matching. If the animal has been registered in the system and a match is found, the animal's identity information is returned. If the match is not successful, or if the animal is not registered, the system will prompt the user to register the animal. The use of a threshold distance and a minimum number of good points reduces the likelihood of incorrect matches, but there is still the possibility of misidentification or false positives. ```
Input: TAG = animal TAG; stream = video stream of animal / image of animal Output: Registered animal, animal's identity information Extracted muzzle point of animal stored in database with TAG while stream do: validate(TAG) frame \(\leftarrow\) stream.frame frame \(\leftarrow\) frame.reshape face \(\leftarrow\) detect(frame, \"Face\") nose \(\leftarrow\) detect(face, \"Nose\") nose.feature \(\leftarrow\) extract_feature (nose) if registering: store_in_database(nose_feature, TAG, identity_info) return image, identity_info else: features, descriptors, identity_info \(\leftarrow\) retrieve_from_database() matches \(\leftarrow\) match_features(nose_feature, features, descriptors) if matches: return identity_info[matches [0]] else: return \"No match found.