From 395ad91560000d153e57b2da802cf51be9bf7e60 Mon Sep 17 00:00:00 2001 From: Rahel Arnold Date: Mon, 29 Jan 2024 21:59:30 +0100 Subject: [PATCH 1/4] add publishing to m3d --- vitrivr-engine-plugin-m3d/build.gradle | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/vitrivr-engine-plugin-m3d/build.gradle b/vitrivr-engine-plugin-m3d/build.gradle index dcc6ac10..970c4a03 100644 --- a/vitrivr-engine-plugin-m3d/build.gradle +++ b/vitrivr-engine-plugin-m3d/build.gradle @@ -1,5 +1,7 @@ plugins { + id 'maven-publish' id 'org.jetbrains.kotlin.plugin.serialization' version "$version_kotlin" + id 'signing' } project.ext.lwjglVersion = "3.3.3" @@ -75,4 +77,75 @@ dependencies { runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" if (lwjglNatives == "natives-macos" || lwjglNatives == "natives-macos-arm64") runtimeOnly "org.lwjgl:lwjgl-vulkan::$lwjglNatives" +} + +dependencies { + api project(':vitrivr-engine-core') +} + +/* Publication of vitrivr engine query to Maven Central. */ +publishing { + publications { + mavenJava(MavenPublication) { + groupId = 'org.vitrivr' + artifactId = 'vitrivr-engine-plugin-m3d' + version = System.getenv().getOrDefault("MAVEN_PUBLICATION_VERSION", version.toString()) + from components.java + pom { + name = 'vitrivr Engine Base' + description = 'Shared based components of the vitrivr multimedia retrieval engine (e.g., database connection, features).' + url = 'https://github.com/vitrivr/vitrivr-engine/' + licenses { + license { + name = 'MIT License' + } + } + developers { + developer { + id = 'ppanopticon' + name = 'Ralph Gasser' + email = 'ralph.gasser@unibas.ch' + } + developer { + id = 'lucaro' + name = 'Luca Rossetto' + email = 'rossetto@ifi.uzh.ch' + } + developer { + id = 'net-cscience-raphael' + name = 'Raphael Waltensül' + email = 'raphael.waltenspuel@unibas.ch' + } + developer { + id = 'rahelarnold98' + name = 'Rahel Arnold' + email = 'rahel.arnold@unibas.ch' + } + developer { + id = 'faberf' + name = 'Fynn Faber' + email = 'fynnfirouz.faber@unibas.ch' + } + } + scm { + connection = 'scm:git:https://github.com/vitrivr/vitrivr-engine.git' + url = 'https://github.com/vitrivr/vitrivr-engine/' + } + } + } + } + repositories { + repositories { + maven { + def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' + name = "OSSRH" + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + credentials { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + } + } + } + } } \ No newline at end of file From afd9c7bd94a8ffd6433faef5fcec0317b720a905 Mon Sep 17 00:00:00 2001 From: Rahel Arnold Date: Fri, 2 Feb 2024 07:34:37 +0100 Subject: [PATCH 2/4] fixed merge conflicts --- .../engine/base/features/external/implementations/clip/CLIP.kt | 2 +- .../engine/base/features/external/implementations/dino/DINO.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/clip/CLIP.kt b/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/clip/CLIP.kt index cc31de8d..eb925b33 100644 --- a/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/clip/CLIP.kt +++ b/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/clip/CLIP.kt @@ -29,7 +29,7 @@ class CLIP : ExternalWithFloatVectorDescriptorAnalyser>() { * * @return [FloatVectorDescriptor] */ - override fun prototype() = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), List(512) { 0.0f }, true) + override fun prototype(field: Schema.Field<*, *>): FloatVectorDescriptor = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), List(512) { 0.0f }, true) /** * Generates and returns a new [Extractor] instance for this [CLIP]. diff --git a/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/dino/DINO.kt b/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/dino/DINO.kt index e9800e53..ebf47740 100644 --- a/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/dino/DINO.kt +++ b/vitrivr-engine-plugin-features/src/main/kotlin/org/vitrivr/engine/base/features/external/implementations/dino/DINO.kt @@ -33,7 +33,7 @@ class DINO : ExternalWithFloatVectorDescriptorAnalyser() { * * @return [FloatVectorDescriptor] */ - override fun prototype() = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), List(384) { 0.0f }, true) + override fun prototype(field: Schema.Field<*, *>): FloatVectorDescriptor = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), List(384) { 0.0f }, true) /** * Generates and returns a new [Extractor] instance for this [DINO]. From fb90c44319d27de1020630cfd8196e55524482f0 Mon Sep 17 00:00:00 2001 From: Rahel Arnold Date: Tue, 12 Mar 2024 15:03:50 +0100 Subject: [PATCH 3/4] continued implementation of MeshDecoder --- .../engine/core/content/ContentFactory.kt | 2 +- .../core/content/impl/InMemoryContentFactory.kt | 8 ++++++-- .../model/content/impl/InMemoryMeshContent.kt | 16 ++++++++++++++++ .../engine/model3d/decoder/MeshDecoder.kt | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/impl/InMemoryMeshContent.kt diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/ContentFactory.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/ContentFactory.kt index 8a1aadb4..22f483bd 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/ContentFactory.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/ContentFactory.kt @@ -15,5 +15,5 @@ interface ContentFactory { fun newTextContent(text: String): TextContent - fun newModel3DContent(model3D: Model3D): Model3DContent + fun newMeshContent(model3D: Model3D): Model3DContent } \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/impl/InMemoryContentFactory.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/impl/InMemoryContentFactory.kt index a842d95c..5d397747 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/impl/InMemoryContentFactory.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/content/impl/InMemoryContentFactory.kt @@ -3,19 +3,23 @@ package org.vitrivr.engine.core.content.impl import org.vitrivr.engine.core.content.ContentFactory import org.vitrivr.engine.core.model.content.element.AudioContent import org.vitrivr.engine.core.model.content.element.ImageContent +import org.vitrivr.engine.core.model.content.element.Model3DContent import org.vitrivr.engine.core.model.content.element.TextContent import org.vitrivr.engine.core.model.content.impl.InMemoryAudioContent import org.vitrivr.engine.core.model.content.impl.InMemoryImageContent +import org.vitrivr.engine.core.model.content.impl.InMemoryMeshContent import org.vitrivr.engine.core.model.content.impl.InMemoryTextContent +import org.vitrivr.engine.core.model.mesh.Model3D import java.awt.image.BufferedImage import java.nio.ShortBuffer -class -InMemoryContentFactory : ContentFactory { +class InMemoryContentFactory : ContentFactory { override fun newImageContent(bufferedImage: BufferedImage): ImageContent = InMemoryImageContent(bufferedImage) override fun newAudioContent(channel: Int, samplingRate: Int, audio: ShortBuffer): AudioContent = InMemoryAudioContent(channel, samplingRate, audio) override fun newTextContent(text: String): TextContent = InMemoryTextContent(text) + + override fun newMeshContent(model3D: Model3D): Model3DContent = InMemoryMeshContent(model3D) } \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/impl/InMemoryMeshContent.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/impl/InMemoryMeshContent.kt new file mode 100644 index 00000000..46d36cc7 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/impl/InMemoryMeshContent.kt @@ -0,0 +1,16 @@ +package org.vitrivr.engine.core.model.content.impl + +import org.vitrivr.engine.core.model.content.element.ImageContent +import org.vitrivr.engine.core.model.content.element.Model3DContent +import org.vitrivr.engine.core.model.mesh.Model3D +import java.awt.image.BufferedImage + +/** + * A naive in-memory implementation of the [ImageContent] interface. + * + * Warning: Usage of [InMemoryMeshContent] may lead to out-of-memory situations in large extraction pipelines. + * + * @author Luca Rossetto. + * @version 1.0.0 + */ +data class InMemoryMeshContent(override val content: Model3D) : Model3DContent diff --git a/vitrivr-engine-plugin-m3d/src/main/kotlin/org/vitrivr/engine/model3d/decoder/MeshDecoder.kt b/vitrivr-engine-plugin-m3d/src/main/kotlin/org/vitrivr/engine/model3d/decoder/MeshDecoder.kt index 79e5e78b..f0b6cff1 100644 --- a/vitrivr-engine-plugin-m3d/src/main/kotlin/org/vitrivr/engine/model3d/decoder/MeshDecoder.kt +++ b/vitrivr-engine-plugin-m3d/src/main/kotlin/org/vitrivr/engine/model3d/decoder/MeshDecoder.kt @@ -58,7 +58,7 @@ class MeshDecoder : DecoderFactory { try { val handler = ModelHandler() val model = source.newInputStream().use { - this.context.contentFactory.newModel3DContent(handler.loadModel(source.sourceId.toString(), source.name.substringAfterLast("."))) + this.context.contentFactory.newMeshContent(handler.loadModel(source.sourceId.toString(), source.name.substringAfterLast("."))) } MeshDecoderWithSource(model, source) } catch (e: IOException) { From 2ebd4ba1b99a382a182293641d35b0a73489faaf Mon Sep 17 00:00:00 2001 From: Rahel Arnold Date: Tue, 12 Mar 2024 15:41:10 +0100 Subject: [PATCH 4/4] added missing function for caching content of 3D models --- .../engine/index/content/FileCachedContentFactory.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/content/FileCachedContentFactory.kt b/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/content/FileCachedContentFactory.kt index 442439d1..864c3f3d 100644 --- a/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/content/FileCachedContentFactory.kt +++ b/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/content/FileCachedContentFactory.kt @@ -5,9 +5,12 @@ import io.github.oshai.kotlinlogging.KotlinLogging import org.vitrivr.engine.core.content.ContentFactory import org.vitrivr.engine.core.model.content.element.AudioContent import org.vitrivr.engine.core.model.content.element.ImageContent +import org.vitrivr.engine.core.model.content.element.Model3DContent import org.vitrivr.engine.core.model.content.element.TextContent +import org.vitrivr.engine.core.model.mesh.Model3D import org.vitrivr.engine.core.util.extension.getRGBArray import org.vitrivr.engine.core.util.extension.setRGBArray +import java.awt.SystemColor.text import java.awt.image.BufferedImage import java.io.IOException import java.lang.ref.PhantomReference @@ -171,4 +174,7 @@ class FileCachedContentFactory(private val basePath: Path) : ContentFactory { } override fun newTextContent(text: String): TextContent = FileBackedTextContent(text) + override fun newMeshContent(model3D: Model3D): Model3DContent { + TODO("Not yet implemented") + } } \ No newline at end of file