Last active
December 15, 2025 17:29
-
-
Save dacr/eac3410e491c4dea228990854aa7d4e8 to your computer and use it in GitHub Desktop.
take a look into models zoo / published by https://github.com/dacr/code-examples-manager #f6b25f1c-2d29-4cdb-a030-f7dbb3b94e96/385f0d352bca0b79815c22e8e17f901d954fb307
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : take a look into models zoo | |
| // keywords : djl, machine-learning, tutorial, detection, ai, zoo, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
| // id : f6b25f1c-2d29-4cdb-a030-f7dbb3b94e96 | |
| // created-on : 2022-03-09T18:41:39+01:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.7.2" | |
| //> using dep "org.slf4j:slf4j-api:2.0.17" | |
| //> using dep "org.slf4j:slf4j-simple:2.0.17" | |
| //> using dep "net.java.dev.jna:jna:5.17.0" | |
| //> using dep "ai.djl:api:0.33.0" | |
| //> using dep "ai.djl:basicdataset:0.33.0" | |
| //> using dep "ai.djl:model-zoo:0.33.0" | |
| //> using dep "ai.djl.huggingface:tokenizers:0.33.0" | |
| //> using dep "ai.djl.mxnet:mxnet-engine:0.33.0" | |
| //> using dep "ai.djl.mxnet:mxnet-model-zoo:0.33.0" | |
| //> using dep "ai.djl.pytorch:pytorch-engine:0.33.0" | |
| //> using dep "ai.djl.pytorch:pytorch-model-zoo:0.33.0" | |
| //> using dep "ai.djl.tensorflow:tensorflow-engine:0.33.0" | |
| //> using dep "ai.djl.tensorflow:tensorflow-model-zoo:0.33.0" | |
| //> using dep "ai.djl.onnxruntime:onnxruntime-engine:0.33.0" | |
| // --------------------- | |
| // inspired from https://docs.djl.ai/examples/docs/object_detection.html | |
| //System.setProperty("org.slf4j.simpleLogger.defaultLogLevel","debug") | |
| import ai.djl.Application | |
| import ai.djl.engine.Engine | |
| import ai.djl.modality.cv.Image | |
| import ai.djl.modality.cv.ImageFactory | |
| import ai.djl.modality.cv.output.DetectedObjects | |
| import ai.djl.repository.zoo.Criteria | |
| import ai.djl.repository.zoo.ModelZoo | |
| import ai.djl.repository.zoo.ZooModel | |
| import ai.djl.training.util.ProgressBar | |
| import java.nio.file.Files | |
| import java.nio.file.Path | |
| import java.nio.file.Paths | |
| import scala.io.AnsiColor.{RESET, RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, UNDERLINED, BOLD} | |
| import scala.jdk.CollectionConverters._ | |
| println(s"${BLUE}======================================= ENGINES =======================================$RESET") | |
| Engine.getAllEngines.asScala.foreach { engine => | |
| println(s"- ${CYAN}$engine${RESET}") | |
| } | |
| println(s"${BLUE}======================================= MODEL ZOO SUPPORTED ENGINES =======================================$RESET") | |
| ModelZoo.listModelZoo().asScala.foreach { modelZoo => | |
| println(s"----------------------") | |
| println(s"groupId=${CYAN}${BOLD}${modelZoo.getGroupId}$RESET supportedEngines=${GREEN}${BOLD}${modelZoo.getSupportedEngines.asScala.mkString(", ")}$RESET") | |
| } | |
| println(s"${BLUE}======================================= APPLICATIONS =======================================$RESET") | |
| ModelZoo.listModels().asScala.foreach { (application, mrls) => | |
| println(s" path=${CYAN}${BOLD}${application.getPath}$RESET") | |
| } | |
| //System.exit(0) | |
| println(s"${BLUE}======================================= MODELS BY APPLICATION =======================================$RESET") | |
| ModelZoo.listModels().asScala.foreach { (application, mrls) => | |
| println(s" path=${CYAN}${BOLD}${application.getPath}$RESET") | |
| mrls.asScala.foreach { mrl => | |
| println(s" mrl=${YELLOW}${BOLD}${mrl.toString}$RESET") | |
| mrl.listArtifacts().asScala.foreach { artifact => | |
| println(s" name=${GREEN}${artifact.getName}$RESET properties=${GREEN}${artifact.getProperties().asScala}$RESET") | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment