YOLOv5 models for low-resolution facial thermography
This repository contains the two YOLOv5m checkpoints described in the manuscript Open-standard infrared thermography implementation based on machine learning object identification for studying facial thermal variations at less restrictive settings.
The checkpoints form a sequential two-stage pipeline for very-low-resolution radiometric thermal images:
weights/face_visibility/best.ptidentifies frames containing usable facial information (faceandno_face).weights/nose_detection/best.ptlocalizes the nose region within the facial crop produced by the first stage.
The models perform spatial localization. They are not identity-recognition models and do not use participant identity or experimental condition as prediction targets.
Transfer-learning strategy
Both models were initialized from pretrained YOLOv5m weights and fine-tuned on manually annotated thermal frames. The purpose of the implementation is to provide a transferable workflow through which researchers can adapt a pretrained object-detection architecture to their own thermal-imaging conditions using a comparatively small annotated dataset.
The training material was sampled from a broader corpus of approximately 1,100 thermal recordings collected across three prior studies with the same camera modules. Recordings lasted between one and five minutes. Random frame sampling was used to represent variation across participants, recordings, and experimental conditions before manual annotation by five laboratory labelers using LabelImg.
Training configuration
| Parameter | Face visibility | Nose detection |
|---|---|---|
| Architecture | YOLOv5m | YOLOv5m |
| Training images | 8,513 | 6,733 |
| Validation images | 1,121 | 889 |
| Test images | 1,071 | 848 |
| Input resolution | 640 px | 1,024 px |
| Batch size | 16 | 8 |
| Optimizer | SGD | Adam |
| Learning rate | 0.01 | Not specified in the manuscript |
| Momentum | 0.937 | Not specified in the manuscript |
| Maximum epochs | 100 | 100 |
| Epochs completed | 100 | 84 |
| Early stopping | Not applied | Patience of 20 epochs |
| Image-weight initialization | Enabled | Not reported in the manuscript |
| Classification-loss factor | 0.5 | Not reported in the manuscript |
| Augmentation scale | Not reported in the manuscript | 0.7 |
| IoU threshold | 0.20 | 0.30 |
For the face-visibility model, mAP@0.5 stabilized approximately between epochs 30 and 50 and reached a maximum of 0.956 at epoch 70. For the nose-detection model, mAP@0.5 stabilized approximately between epochs 20 and 25, with values between 0.985 and 0.989; training stopped at epoch 84 through early stopping.
An audit of the distributed face-visibility labels found 9,013 images annotated only as face, 1,691 annotated only as no_face, and one image containing both classes. Accordingly, images exclusively annotated as no_face represent 15.80% of the 10,705-image dataset; images containing at least one no_face annotation represent 15.81%. Class imbalance in the face-visibility task was addressed during training through class weighting, adaptive sampling, and image-weight initialization.
The corresponding YOLO-format datasets are available in LiFLabUC/NoseNet-training-data.
The frozen checkpoints were also evaluated on a participant-independent set of 220 thermal frames with no exact image overlap with training. The frames, annotations, pseudonymized manifest, protocol and results are available in LiFLabUC/NoseNet-independent-validation.
Inference workflow
During inference, the face-visibility model analyzes each thermal frame independently. Frames containing usable facial information are cropped to the detected facial bounding box, masked to suppress surrounding context, and resized. The nose-detection model then processes the facial image and returns the nose bounding-box coordinates.
The nose is the primary region of interest used in the reported implementation. Its localization can also provide a geometric reference for exploring other facial regions, but nose detection is not presented as a mandatory prerequisite for every possible facial ROI.
Code
The complete processing workflow and dependencies are documented in the project GitHub repository. Clone that repository and place these checkpoint files in the corresponding weight directories, or update the checkpoint paths supplied to the inference scripts.
Intended use
These checkpoints support research workflows for locating faces and nasal regions in low-resolution thermal recordings obtained under low-restriction conditions, including unrestricted head movement and non-homogeneous backgrounds.
The implementation is intended to facilitate extraction of facial temperature dynamics. It is not intended to provide precise absolute-temperature measurements, identity recognition, surveillance, diagnosis, or clinical decision-making.
Limitations
- Performance may change with camera geometry, distance, occlusion, thermal contrast, acquisition conditions, and preprocessing.
- The nose stage operates on the facial crop generated by the first stage.
- Researchers should validate and, when necessary, fine-tune the models for new camera systems or substantially different recording conditions.
- The respiratory-frequency analysis described in the associated manuscript is exploratory and was not validated against an independent respiratory measurement.
Ethical use and license
Thermal recordings of research participants must be handled according to informed-consent terms, ethics approval, institutional requirements, and applicable data-use agreements. No reuse license is granted by this card. Access and redistribution remain subject to the terms established by the authors and responsible institutions.