change the resource path where AI models are stored

This commit is contained in:
Denis-Cosmin Nutiu 2024-03-24 15:21:57 +02:00
parent 146db2c9c0
commit bdd76877ef
4 changed files with 4 additions and 4 deletions

2
.gitignore vendored
View file

@ -42,4 +42,4 @@ bin/
.DS_Store
# Deep learning models
src/main/resources/AIModels/prediction.onnx
src/main/resources/dev/nuculabs/imagetagger/ai/*.onnx

View file

@ -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:

View file

@ -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())
}