Last active
May 25, 2024 10:18
-
-
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/90f2b307b6b65a123ab20cb16fae45f3c5b8ea45
This file contains 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.4.2" | |
//> using dep "org.slf4j:slf4j-api:2.0.13" | |
//> using dep "org.slf4j:slf4j-simple:2.0.13" | |
//> using dep "net.java.dev.jna:jna:5.14.0" | |
//> using dep "ai.djl:api:0.28.0" | |
//> using dep "ai.djl:basicdataset:0.28.0" | |
//> using dep "ai.djl:model-zoo:0.28.0" | |
//> using dep "ai.djl.huggingface:tokenizers:0.28.0" | |
//> using dep "ai.djl.mxnet:mxnet-engine:0.28.0" | |
//> using dep "ai.djl.mxnet:mxnet-model-zoo:0.28.0" | |
//> using dep "ai.djl.pytorch:pytorch-engine:0.28.0" | |
//> using dep "ai.djl.pytorch:pytorch-model-zoo:0.28.0" | |
//> using dep "ai.djl.tensorflow:tensorflow-engine:0.28.0" | |
//> using dep "ai.djl.tensorflow:tensorflow-model-zoo:0.28.0" | |
////> using dep "ai.djl.paddlepaddle:paddlepaddle-engine:0.28.0" | |
////> using dep "ai.djl.paddlepaddle:paddlepaddle-model-zoo:0.28.0" | |
//> using dep "ai.djl.onnxruntime:onnxruntime-engine:0.28.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}======================================= MODELS =======================================$RESET") | |
ModelZoo.listModels().asScala.foreach { (application, artifacts) => | |
println(s" path=${CYAN}${BOLD}${application.getPath}$RESET") | |
artifacts.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