Commit Graph

9 Commits

Author SHA1 Message Date
raystlin
adc4dc0f74 Added new parameters to model input.
New parameters have been added to define the input of the models:
* ResizeOperation: by default center-crop was being performed, now it is
  configurable.
* InputOrder: by default RGB was being used as the order for the array
  values of the input tensor, now it can be configured.
* InputInterval has been changed to InputIntervals (an slice). This
  means that every channel can have its own interval conversion.
* InputInterval can define now stddev and mean, because sometimes
  instead of adjusting the interval, the stddev and mean of the training
data should be use.
2025-07-15 13:31:31 +00:00
raystlin
d082929dee Removed parameter Channels
It seems to be standarized, so it is now used as an additional check for
input signatures.
2025-04-16 08:19:58 +00:00
raystlin
5521d06bc0 Added Interval parameter to PhotoInput
This parameter allows us to rescale the input of the models because some
of them need values between [0, 1] and other between [-1, 1].
2025-04-13 20:32:02 +00:00
raystlin
d993eb2a85 AI: Added some intelligence to label loading.
Now when loading labels internal/ai/tensorflow package will try to look
for all the files that match the glob label*.txt and will return the
labels that match the expected number. Some models add a first label
called background, which is a bias.
Also, a new parameter has been added to models to allow a second path to
look for the label files. This path is set to nasnet asset on
internal/ai/vision.
2025-04-13 14:49:54 +00:00
raystlin
88508679b0 Modified classify to add custom models
Vision input parameters have also been changed to support the new
parameters needed for the models.
2025-04-11 20:01:36 +00:00
raystlin
8bc7121394 Added a comment to clarify
EnsureShape operation may seem unnecesary, but PredictCosts fails it it
is not added to the graph.
2025-04-11 16:57:27 +00:00
raystlin
7bcbaea492 Dynamically add a softmax layer to a loaded graph.
By inspecting existing models we saw that many times logits are returned
instead of probabilities. Photoprism uses probabilites to rank the
quality of the results, so we need to transform those logits. Our
approach is to add a new layer at runtime to the graph that performs the
softmax operation.
2025-04-11 14:32:17 +00:00
raystlin
d0f6d903e2 Added utilities to inspect tensorflow models.
These new functions allows us to inspect the saved models, get the tags
and try to guess the inputs and outputs.
2025-04-11 14:30:48 +00:00
Michael Mayer
bfdb839d01 AI: Add TensorFlow utility package and improve model loading #127 #1090
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-07 05:26:45 +02:00