This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit e6b82ec109c3d68b47c4c91201d11e978c446e36 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Apr 7 15:23:19 2020 +0200 Camel-djl: Regen --- docs/components/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/djl-component.adoc | 214 +++++++++++++++++++++ docs/components/modules/ROOT/pages/index.adoc | 4 +- 3 files changed, 218 insertions(+), 1 deletion(-) diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index 09cfd79..cbf4e5f 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -104,6 +104,7 @@ ** xref:direct-component.adoc[Direct Component] ** xref:direct-vm-component.adoc[Direct VM Component] ** xref:disruptor-component.adoc[Disruptor Component] +** xref:djl-component.adoc[DJL Component] ** xref:dns-component.adoc[DNS Component] ** xref:docker-component.adoc[Docker Component] ** xref:dozer-component.adoc[Dozer Component] diff --git a/docs/components/modules/ROOT/pages/djl-component.adoc b/docs/components/modules/ROOT/pages/djl-component.adoc new file mode 100644 index 0000000..31c4534 --- /dev/null +++ b/docs/components/modules/ROOT/pages/djl-component.adoc @@ -0,0 +1,214 @@ +[[djl-component]] += DJL Component +:page-source: components/camel-djl/src/main/docs/djl-component.adoc + +*Since Camel 3.2* + +*Since Camel 3.2* + + +// HEADER START +*Only producer is supported* +// HEADER END + +The *Deep Java Library* component is used to infer Deep Learning models from message exchanges data. +This component uses https://djl.ai/[Deep Java Library] as underlying library. + +In order to use the DJL component, Maven users will need to add the +following dependency to their `pom.xml`: + +*pom.xml* + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-djl</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + +// component options: START +The DJL component supports 2 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +|=== +// component options: END + +The DJL component only supports producer endpoints. + +// endpoint options: START +The DJL endpoint is configured using URI syntax: + +---- +djl:application +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *application* | *Required* Application name | | String +|=== + + +=== Query Parameters (6 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *artifactId* (producer) | Model Artifact | | String +| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *model* (producer) | Model | | String +| *translator* (producer) | Translator | | String +| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean +|=== +// endpoint options: END + + +=== Model Zoo + +The following table contains supported models in the model zoo: + +[width="100%",cols="1,3,5,3,5,5",options="header"] +|=== +| CV | Image Classification | Resnet image classification | `cv/image_classification` | `ai.djl.zoo:resnet:0.0.1` | {layers=50, flavor=v1, dataset=cifar10} +| CV | Image Classification | MLP image classification | `cv/image_classification` | `ai.djl.zoo:mlp:0.0.2` | {dataset=mnist} +| CV | Image Classification | MLP image classification | `cv/image_classification` | `ai.djl.mxnet:mlp:0.0.1` | {dataset=mnist} +| CV | Image Classification | Resnet image classification | `cv/image_classification` | `ai.djl.mxnet:resnet:0.0.1` | {layers=18, flavor=v1, dataset=imagenet} +| CV | Image Classification | Resnet image classification | `cv/image_classification` | `ai.djl.mxnet:resnet:0.0.1` | {layers=50, flavor=v2, dataset=imagenet} +| CV | Image Classification | Resnet image classification | `cv/image_classification` | `ai.djl.mxnet:resnet:0.0.1` | {layers=152, flavor=v1d, dataset=imagenet} +| CV | Image Classification | Resnet image classification | `cv/image_classification` | `ai.djl.mxnet:resnet:0.0.1` | {layers=50, flavor=v1, dataset=cifar10} +| CV | Image Classification | Resnext image classification | `cv/image_classification` | `ai.djl.mxnet:resnext:0.0.1` | {layers=101, flavor=64x4d, dataset=imagenet} +| CV | Image Classification | Senet image classification | `cv/image_classification` | `ai.djl.mxnet:senet:0.0.1` | {layers=154, dataset=imagenet} +| CV | Image Classification | Senet and Resnext image classification | `cv/image_classification` | `ai.djl.mxnet:se_resnext:0.0.1` | {layers=101, flavor=32x4d, dataset=imagenet} +| CV | Image Classification | Senet and Resnext image classification | `cv/image_classification` | `ai.djl.mxnet:se_resnext:0.0.1` | {layers=101, flavor=64x4d, dataset=imagenet} +| CV | Image Classification | Squeezenet image classification | `cv/image_classification` | `ai.djl.mxnet:squeezenet:0.0.1` | {flavor=1.0, dataset=imagenet} +| CV | Object Detection | Single Shot Detection for Object Detection | `cv/object_detection` | `ai.djl.zoo:ssd:0.0.1` | {flavor=tiny, dataset=pikachu} +| CV | Object Detection | Single-shot object detection | `cv/object_detection` | `ai.djl.mxnet:ssd:0.0.1` | {size=512, backbone=resnet50, flavor=v1, dataset=voc} +| CV | Object Detection | Single-shot object detection | `cv/object_detection` | `ai.djl.mxnet:ssd:0.0.1` | {size=512, backbone=vgg16, flavor=atrous, dataset=coco} +| CV | Object Detection | Single-shot object detection | `cv/object_detection` | `ai.djl.mxnet:ssd:0.0.1` | {size=512, backbone=mobilenet1.0, dataset=voc} +| CV | Object Detection | Single-shot object detection | `cv/object_detection` | `ai.djl.mxnet:ssd:0.0.1` | {size=300, backbone=vgg16, flavor=atrous, dataset=voc} +|=== + + +=== DJL Engine implementation + +Because DJL is deep learning framework agnostic, you don't have to make a choice between frameworks when creating your projects. +You can switch frameworks at any point. +To ensure the best performance, DJL also provides automatic CPU/GPU choice based on hardware configuration. + +==== MxNet engine + +You can pull the MXNet engine from the central Maven repository by including the following dependency: + +[source,xml] +---- +<dependency> + <groupId>ai.djl.mxnet</groupId> + <artifactId>mxnet-engine</artifactId> + <version>0.4.0</version> + <scope>runtime</scope> +</dependency> +---- + +DJL offers an automatic option that will download the jars the first time you run DJL. +It will automatically determine the appropriate jars for your system based on the platform and GPU support. + +[source,xml] +---- + <dependency> + <groupId>ai.djl.mxnet</groupId> + <artifactId>mxnet-native-auto</artifactId> + <version>1.6.0</version> + <scope>runtime</scope> + </dependency> +---- + +More information about https://github.com/awslabs/djl/blob/master/mxnet/mxnet-engine/README.md#installation[MxNet engine installation] + +==== PyTorch engine + +You can pull the PyTorch engine from the central Maven repository by including the following dependency: + +[source,xml] +---- +<dependency> + <groupId>ai.djl.mxnet</groupId> + <artifactId>pytorch-engine</artifactId> + <version>0.4.0</version> + <scope>runtime</scope> +</dependency> +---- + +DJL offers an automatic option that will download the jars the first time you run DJL. +It will automatically determine the appropriate jars for your system based on the platform and GPU support. + +[source,xml] +---- + <dependency> + <groupId>ai.djl.mxnet</groupId> + <artifactId>pytorch-native-auto</artifactId> + <version>1.4.0</version> + <scope>runtime</scope> + </dependency> +---- + +More information about https://github.com/awslabs/djl/blob/master/pytorch/pytorch-engine/README.md#installation[PyTorch engine installation] + +==== Tensorflow engine + +Right now, the TensorFlow Engine is still experimental. + + +=== Examples + +==== MNIST image classification from file +[source,java] +---- +from("file:/data/mnist/0/10.png") + .to("djl:cv/image_classification?artifactId=ai.djl.mxnet:mlp:0.0.1"); +---- + +==== Object detection +[source,java] +---- +from("file:/data/mnist/0/10.png") + .to("djl:cv/image_classification?artifactId=ai.djl.mxnet:mlp:0.0.1"); +---- + +==== Custom deep learning model +[source,java] +---- +// create deep learning model +Model model = Model.newInstance(); +model.setBlock(new Mlp(28 * 28, 10, new int[]{128, 64})); +model.load(Paths.get(MODEL_DIR), MODEL_NAME); + +// create translator for pre-processing and postprocessing +ImageClassificationTranslator.Builder builder = ImageClassificationTranslator.builder(); +builder.setSynsetArtifactName("synset.txt"); +builder.setPipeline(new Pipeline(new ToTensor())); +builder.optApplySoftmax(true); +ImageClassificationTranslator translator = new ImageClassificationTranslator(builder); + +// Bind model and translator beans +context.getRegistry().bind("MyModel", model); +context.getRegistry().bind("MyTranslator", translator); + +from("file:/data/mnist/0/10.png") + .to("djl:cv/image_classification?model=MyModel&translator=MyTranslator"); +---- diff --git a/docs/components/modules/ROOT/pages/index.adoc b/docs/components/modules/ROOT/pages/index.adoc index c21aa49..deedae7 100644 --- a/docs/components/modules/ROOT/pages/index.adoc +++ b/docs/components/modules/ROOT/pages/index.adoc @@ -11,7 +11,7 @@ Below is the list of components that are provided by Apache Camel. == List of Components // components: START -Number of Components: 328 in 261 JAR artifacts (1 deprecated) +Number of Components: 329 in 262 JAR artifacts (1 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -207,6 +207,8 @@ Number of Components: 328 in 261 JAR artifacts (1 deprecated) | xref:disruptor-component.adoc[Disruptor] (camel-disruptor) | 2.12 | The disruptor component provides asynchronous SEDA behavior using LMAX Disruptor. +| xref:djl-component.adoc[DJL] (camel-djl) | 3.2 | Represents a DJL endpoint. + | xref:dns-component.adoc[DNS] (camel-dns) | 2.7 | To lookup domain information and run DNS queries using DNSJava. | xref:docker-component.adoc[Docker] (camel-docker) | 2.15 | The docker component is used for managing Docker containers.