Classifier evidence with explicit display-versus-radiometric model inputs. More...
#include "lwir_inference.h"#include "lwir_container.h"#include "lwir_frame.h"#include "inference_jpeg.h"#include <math.h>#include <stdio.h>#include <string.h>#include <unistd.h>
Go to the source code of this file.
Functions | |
| bool | lwir_inference_open (const struct inference_settings *settings, double threshold, unsigned category, char *error, size_t capacity) |
| Open and qualify the LWIR classifier (see lwir_inference.h). | |
| bool | lwir_inference_image (const char *filename, unsigned long long sequence, char *error, size_t capacity) |
| Classify one saved photo and publish its evidence sidecar. | |
| void | lwir_inference_close (void) |
| Release the classifier; harmless when not open. Threshold/category are reset by the next open. | |
Variables | |
| static struct inference_context | network |
| The single open classifier; storage != NULL means open. | |
| static unsigned char | thermal_plane [LWIR_MAX_WIDTH *LWIR_MAX_HEIGHT *2] |
| Kelvin*64 samples for radiometric models. | |
| static double | score_threshold |
| Inclusive acceptance threshold set at open. | |
| static unsigned | class_index |
| Reported class within the probability vector. | |
Detailed Description
Classifier evidence with explicit display-versus-radiometric model inputs.
A class probability is neither a temperature correction nor a geographic hotspot result. One model is held in module-static storage (no heap here; the inference context owns its own storage). Pixel-domain models read the display JPEG; other models require the embedded temperature layer. Results go to an exclusively created "<photo>.lwir.ini" sidecar; the photograph itself is never modified.
Definition in file lwir_inference.c.
Function Documentation
◆ lwir_inference_close()
| void lwir_inference_close | ( | void | ) |
Release the classifier; harmless when not open. Threshold/category are reset by the next open.
Release the serialized classifier; repeated closes are harmless.
Definition at line 139 of file lwir_inference.c.
◆ lwir_inference_image()
| bool lwir_inference_image | ( | const char * | filename, |
| unsigned long long | sequence, | ||
| char * | error, | ||
| size_t | capacity ) |
Classify one saved photo and publish its evidence sidecar.
Classify one immutable JPEG/temperature plane and exclusively publish its model-identified sidecar.
- Returns
- True once the sidecar is fully written and fsynced. False if the model is not open, input is missing/invalid, any probability is outside [0,1], hashing fails, or the sidecar exists or cannot be written (a partial sidecar is removed). The photograph is untouched in every case.
Records image and model hashes, input units, synthetic-temperature flag, source size, class, probability and accepted (probability >= threshold).
- Note
- synthetic_temperature is only meaningful for temperature-input models; pixel-input models always record 0.
- The image hash is computed after inference by a separate file read.
Definition at line 83 of file lwir_inference.c.
◆ lwir_inference_open()
| bool lwir_inference_open | ( | const struct inference_settings * | settings, |
| double | threshold, | ||
| unsigned | category, | ||
| char * | error, | ||
| size_t | capacity ) |
Open and qualify the LWIR classifier (see lwir_inference.h).
Open one explicit LWIR classifier with a declared pixel or radiometric input domain.
- Returns
- True if open (or already open); false on bad arguments, open failure or an unsupported model contract, leaving nothing open.
Requires exactly one input and one float32 output of at most 4096 classes containing category; non-pixel (temperature) inputs must be single channel.
- Note
- Already open: returns true immediately and keeps the earlier threshold/category.
Definition at line 49 of file lwir_inference.c.
Variable Documentation
◆ class_index
|
static |
Reported class within the probability vector.
Definition at line 38 of file lwir_inference.c.
◆ network
|
static |
The single open classifier; storage != NULL means open.
Definition at line 35 of file lwir_inference.c.
◆ score_threshold
|
static |
Inclusive acceptance threshold set at open.
Definition at line 37 of file lwir_inference.c.
◆ thermal_plane
|
static |
Kelvin*64 samples for radiometric models.
Definition at line 36 of file lwir_inference.c.