From bdd76877efd827506318206904d3a4d505363e23 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 24 Mar 2024 15:21:57 +0200 Subject: [PATCH] change the resource path where AI models are stored --- .gitignore | 2 +- readme.md | 2 +- .../kotlin/dev/nuculabs/imagetagger/ai/ImageTagsPrediction.kt | 4 ++-- .../nuculabs/imagetagger/ai}/prediction_categories.txt | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename src/main/resources/{AIModels => dev/nuculabs/imagetagger/ai}/prediction_categories.txt (100%) diff --git a/.gitignore b/.gitignore index 39386a6..eb3460f 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,4 @@ bin/ .DS_Store # Deep learning models -src/main/resources/AIModels/prediction.onnx \ No newline at end of file +src/main/resources/dev/nuculabs/imagetagger/ai/*.onnx \ No newline at end of file diff --git a/readme.md b/readme.md index ed03978..fdc4df7 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,7 @@ The release archive is in the [releases page](https://github.com/dnutiu/ImageTag To build from source you will need Java 17 JDK and Gradle. Due to some GitHub limitations that do not allow me to upload large files, you'll need to download the AIModels -zip file which contains the deep learning models and place them into the `ImageTagger/src/main/resources/AIModels` path. +zip file which contains the deep learning models and place them into the `ImageTagger/src/main/resources/dev/nuculabs/imagetagger/ai` path. To build the project run: diff --git a/src/main/kotlin/dev/nuculabs/imagetagger/ai/ImageTagsPrediction.kt b/src/main/kotlin/dev/nuculabs/imagetagger/ai/ImageTagsPrediction.kt index 85b2107..1055340 100644 --- a/src/main/kotlin/dev/nuculabs/imagetagger/ai/ImageTagsPrediction.kt +++ b/src/main/kotlin/dev/nuculabs/imagetagger/ai/ImageTagsPrediction.kt @@ -21,13 +21,13 @@ class ImageTagsPrediction private constructor() { init { try { logger.info("Loaded ML model.") - ImageTagsPrediction::class.java.getResourceAsStream("/AIModels/prediction.onnx").let { modelFile -> + ImageTagsPrediction::class.java.getResourceAsStream("/dev/nuculabs/imagetagger/ai/prediction.onnx").let { modelFile -> ortSession = ortEnv.createSession( modelFile!!.readBytes(), OrtSession.SessionOptions() ) } - ImageTagsPrediction::class.java.getResourceAsStream("/AIModels/prediction_categories.txt") + ImageTagsPrediction::class.java.getResourceAsStream("/dev/nuculabs/imagetagger/ai/prediction_categories.txt") .let { classesFile -> modelClasses.addAll(0, classesFile!!.bufferedReader().readLines()) } diff --git a/src/main/resources/AIModels/prediction_categories.txt b/src/main/resources/dev/nuculabs/imagetagger/ai/prediction_categories.txt similarity index 100% rename from src/main/resources/AIModels/prediction_categories.txt rename to src/main/resources/dev/nuculabs/imagetagger/ai/prediction_categories.txt