Commit Graph

46 Commits

Author SHA1 Message Date
Michael Mayer
780a870f5c CI: Apply Go more linter recommendations to "ai/classify" package #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-22 11:30:58 +01:00
Michael Mayer
4682791253 CI: Apply Go linter recommendations to "ai/classify" package #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-22 11:19:30 +01:00
Michael Mayer
a921f82a17 Pkg: Move /service/http/... to /http/... and add package /http/dns
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-10-19 21:08:48 +02:00
Michael Mayer
e5dc335bcf AI: Include NSFW flag & score when generating labels with Ollama #5232
Related issues: #5233 (reset command), #5234 (schedule for models)

Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-10-05 04:23:36 +02:00
Michael Mayer
94b6631b3d Test: Use PascalCase names for all Go subtests in /internal
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-10-02 14:50:02 +02:00
Michael Mayer
746f26724c AI: Improve the generation, sorting, and filtering of labels #5232
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-10-02 13:08:52 +02:00
Michael Mayer
61ced7119c Auth: Refactor cluster configuration and provisioning API endpoints #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-09-24 08:28:38 +02:00
Michael Mayer
023fbe3a1d Pkg: Add service/cluster package & rename media/http → service/http #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-09-13 12:58:28 +02:00
graciousgrey
cc0661eff6 AI: Improve rules.yml 2025-09-08 10:16:25 +02:00
raystlin
519a6ab34a AI: Add TensorFlow model shape detection #127 #5164
* AI: Added support for non BHWC models

Tensorflow models use BHWC by default, however, if we are using
converted models, we can find that the expected input is BCHW. Now the
input is configurable (although the restriction of being dimesion 4 is
still there) via Shape parameter on the input definition. Also, the
model instrospection will try to deduce the input shape from the model
signature.

* AI: Added more tests for enum parsing

ShapeComponent was missing from the tests

* AI: Modified external tests to the new url

The path has been moved from tensorflow/vision to tensorflow/models

* AI: Moved the builder to the model to reuse it

It should reduce the amount of allocations done

* AI: fixed errors after merge

Mainly incorrect paths and duplicated variables
2025-08-16 15:55:59 +02:00
Michael Mayer
ab0bd1c732 Config: Change default vision model assets path to assets/models/ #127
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-08-08 19:06:56 +02:00
graciousgrey
3c84771c01 AI: Update rules.yml to work with original ImageNet1k labels 2025-08-06 17:22:58 +02:00
Michael Mayer
b241fa621d AI: Refactor error logs in internal/ai packages #127 #5011
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-08-04 12:14:23 +02:00
Michael Mayer
3177a61f75 AI: Update log messages and tests in internal/ai/classify #127 #5011
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-08-04 10:31:39 +02:00
Michael Mayer
10fe7d2b40 AI: Make error messages lower case in ai/tensorflow/info.go #127 #5011
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-08-04 10:00:09 +02:00
raystlin
aeba5bfc4c Added labels download to model_external_test
If a model needs to have its labels downloaded from another source, it
can now be added to the test information.
2025-07-26 22:27:20 +00:00
raystlin
3b1e1bb32a Added tests for resize operations
And fixed a typo detected by using them.
2025-07-25 22:22:19 +00:00
raystlin
e704ccfc47 Merge branch 'develop' into feature/custom-tf-model-127 2025-07-25 21:22:28 +00:00
raystlin
1912f17aaf Changed InputOrder to ColorChannelOrder
The previous name was not clear enough.
2025-07-17 21:26:50 +00:00
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
graciousgrey
f7218f67e2 Classify: Improve rules.yml #5057 2025-06-19 09:14:02 +02:00
raystlin
f28f3d1a07 Fixed format on model_external_test
make fmt-go was applied
2025-05-18 11:06:34 +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
eca0bc5205 AI Test: Added path protection to tests
As we are decompressing, we have to check the paths before writing to
disk.
2025-04-14 19:32:42 +00:00
raystlin
8d9a16cef6 AI Test: Added resolution to external models
The definition of the models now contain the expected resolution. This
has improved the results for efficientnet-m.
2025-04-14 08:15:10 +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
457a47b36f AI: Added a test for external models
The tests has a envar check to avoid running it by default, as it
downloads the models and generates a lot of errors.
2025-04-13 14:54:42 +00:00
raystlin
ad94d03576 Fixed classify and nsfw tests
They were broken when the constructors changed to include metadata.
2025-04-13 14:53:34 +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
0895a085a1 Migrated nsfw to the new model loading system.
nsfw/model.go and vision/model.go modified to make it work. Testing
remains undone.
2025-04-11 20:29:31 +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
Michael Mayer
190be2a1b5 AI: Finalize facial embeddings, labels and nsfw API endpoints #127 #1090
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-10 20:28:26 +02:00
Michael Mayer
caf3ae1ab5 AI: Refactor use of face embeddings, labels, and nsfw models #127 #1090
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-10 16:49:34 +02:00
Michael Mayer
cf3b933e59 API: Refactor data URL encoding and decoding in pkg/media #127 #1090
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-09 10:58:48 +02:00
Michael Mayer
7f1041c434 Labels: Add image classification service client #127 #1090
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-08 04:14:18 +02:00
Michael Mayer
f3e066af45 AI: Add Vision API service endpoint for image classification #127 #1090
This is a proof of concept and still under development. The other
Vision API endpoints are stubs for testing and not yet functional.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-07 12:19:39 +02: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
Michael Mayer
35e9294d87 AI: Add vision package and vision API endpoints #127 #1090
These changes allow to configure the computer vision models through an
optional vision.yml configuration file. Note that the API endpoints
are not yet functional and require further work.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-06 23:39:37 +02:00
Michael Mayer
083c59550a AI: Upgrade Go language bindings for the TensorFlow C API #222
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-04-02 04:16:27 +02:00
Michael Mayer
6a89519e63 Videos: Refactor codec, content and file type specifications #4770
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-02-05 00:30:45 +01:00
Michael Mayer
ebeaaf568b Metadata: Set labels based on matching keywords in the caption #4603
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-01-17 06:24:29 +01:00
Michael Mayer
01f15fa406 Backend: Update copyright notices
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-01-09 10:28:17 +01:00
Michael Mayer
924ddcf2cd Index: Set labels based on matching keywords in title or subject #4602
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-11-01 12:15:39 +01:00
Michael Mayer
44d6393870 Classify: Fix typo in rule.yml #4540
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-10-01 11:38:17 +02:00
Michael Mayer
eed69eda20 AI: Fix model paths in tests after moving classify, face & nsfw packages
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-07-02 08:20:19 +02:00
Michael Mayer
3c6006d969 Backend: Rename /internal/tensorflow to /internal/ai
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-07-02 08:08:14 +02:00