djl icon indicating copy to clipboard operation
djl copied to clipboard

Wrong indexes in SSDTranslator output process

Open kkoripl opened this issue 5 years ago • 4 comments

Description

When trying to import tensorflow objects detection model I needed to make custom translator, as library informed me it was needed. When method copied from output processing of SingleShotDetectionTranslator it showed 2 flaws:

  • wrong indexes to get probabilities, bounding boxes and class ids
  • wrong indexes to build rect objects of bounding boxes (as boxes are drawn as they were twisted 90 degrees and in wrong place)

Expected Behavior

NDList which is given to process output for object detection should have at index:

  • 0 => class ids, but it has bounding boxes
  • 1 => probabilities, but it has class ids
  • 2 => bounding boxes, but it has probabilities

Then, when actually making bounding boxes rect's it's x, y, w and h attributes are calculated wrongly or situated in wrong order in constructor of Rect object.

  • it is: Rectangle rect = new Rectangle(x, y, w, h); but as I tested it should be new Rectangle(y, x, h, w);

Error Message

For wrong indexes of probabilities and so on - bounding box is throwing these: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at djl.config.DjlConfig$1.processOutput(DjlConfig.java:120) ~[classes/:na] at djl.config.DjlConfig$1.processOutput(DjlConfig.java:97) ~[classes/:na] at ai.djl.inference.Predictor.processOutputs(Predictor.java:220) ~[api-0.9.0.jar:na] at ai.djl.inference.Predictor.batchPredict(Predictor.java:176) ~[api-0.9.0.jar:na] at ai.djl.inference.Predictor.predict(Predictor.java:128) ~[api-0.9.0.jar:na] at djl.objectDetection.ObjectDetectionService.externalDetectObjects(ObjectDetectionService.java:55) ~[classes/:na] at djl.controller.ObjectDetectionController.detectExternal(ObjectDetectionController.java:32) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.33.jar:9.0.33] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

For wrong bounding box indexes there is no message, but look on the picture of them being drawn (DJL Image.drawBoundingBox used): image

Steps to reproduce

  1. Import Tensorflow Object Detection model - I used this: https://tfhub.dev/tensorflow/centernet/resnet50v2_512x512_kpts/1
  2. Code for import:
        SingleShotDetectionTranslator.Builder ssdBuilder = SingleShotDetectionTranslator.builder()
                .setPipeline(new Pipeline())
                .optThreshold(0.6f)
                .optSynsetUrl("file:///"+Paths.get("/home/kfrac/Projects/edu/java-machine-learning/mlp_model/centernet/synset.txt").toAbsolutePath().toString());

        ObjectDetectionTranslator translator = new ObjectDetectionTranslator(ssdBuilder) {
            // COMPLETE COPY OF PROCESSOUTPUT FROM SINGLESHOTDETECTIONTRANSLATOR!
            @Override
            public DetectedObjects processOutput(TranslatorContext ctx, NDList list) throws Exception {
                float[] classIds = list.get(0).toFloatArray();
                float[] probabilities = list.get(1).toFloatArray();
                NDArray boundingBoxes = list.get(2);

                List<String> retNames = new ArrayList<>();
                List<Double> retProbs = new ArrayList<>();
                List<BoundingBox> retBB = new ArrayList<>();

                for (int i = 0; i < classIds.length; ++i) {
                    int classId = (int) classIds[i];
                    double probability = probabilities[i];
                    // classId starts from 0, -1 means background
                    if (classId >= 0 && probability > threshold) {
                        if (classId >= classes.size()) {
                            throw new AssertionError("Unexpected index: " + classId);
                        }
                        String className = classes.get(classId);
                        float[] box = boundingBoxes.get(i).toFloatArray();
                        // rescale box coordinates by imageWidth and imageHeight
                        double x = imageWidth > 0 ? box[0] / imageWidth : box[0];
                        double y = imageHeight > 0 ? box[1] / imageHeight : box[1];
                        double w = imageWidth > 0 ? box[2] / imageWidth - x : box[2] - x;
                        double h = imageHeight > 0 ? box[3] / imageHeight - y : box[3] - y;

                        Rectangle rect = new Rectangle(x, y, w, h);
                        retNames.add(className);
                        retProbs.add(probability);
                        retBB.add(rect);
                    }
                }

                return new DetectedObjects(retNames, retProbs, retBB);
            }
        };

        Criteria<Image, DetectedObjects> criteria =
                Criteria.builder()
                .optApplication(Application.CV.OBJECT_DETECTION)
                .setTypes(Image.class, DetectedObjects.class)
                .optEngine("TensorFlow")
                .optTranslator(translator)
                .optOption("Tags", "serve")
                .optFilter("backbone", "ResNet-v2-50")
                .optModelUrls("your-model-path")
                .build();

        ZooModel<Image, DetectedObjects> model = ModelZoo.loadModel(criteria);
  1. Use this synset synset.txt

  2. Detection on BufferedImage like:

        Image img = BufferedImageFactory.getInstance().fromImage(image);
        DetectedObjects detectionResult = model.newPredictor().predict(img);
        img.drawBoundingBoxes(detectionResult);

with image: 1920x1440_A189584_large

What have you tried to solve it?

Wrong indexes for probabilities and others:

 float[] classIds = list.get(1).toFloatArray();
  float[] probabilities = list.get(2).toFloatArray();
  NDArray boundingBoxes = list.get(0);

Wrong indexes for bounding boxes drawings: Rectangle rect = new Rectangle(y, x, h, w);

Environment Info

Maven:

4.0.0

<groupId>org.example</groupId>
<artifactId>java-machine-learning</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
    <artifactId>spring-boot-starter-parent</artifactId>
    <groupId>org.springframework.boot</groupId>
    <version>2.2.6.RELEASE</version>
</parent>

<properties>
    <spring-boot.version>2.2.6.RELEASE</spring-boot.version>
    <codehaus.mojo.version>1.6.0</codehaus.mojo.version>
    <java.version>11</java.version> <!-- 11 is the lowest supported java version, however 12 and 13 should work fine -->
    <jna.version>5.3.0</jna.version> <!-- Required to override default JNA version for Spring Boot parent-->
    <djl.version>0.9.0</djl.version>
    <djl-repository.version>0.4.1</djl-repository.version>
    <djl-mxnet-native.version>1.7.0-b</djl-mxnet-native.version>
    <djl-tensorflow-native.version>2.3.1</djl-tensorflow-native.version>
    <djl.starter.version>0.7</djl.starter.version>
    <log4j.version>2.12.1</log4j.version>
    <commons-cli.version>1.4</commons-cli.version>
    <lombok.version>1.18.0</lombok.version>
    <commons-csv.version>1.8</commons-csv.version>
    <opencv.version>4.3.0-3</opencv.version>
    <tablesaw-core.version>0.38.1</tablesaw-core.version>
    <dozer.version>5.5.1</dozer.version>
    <junit.version>4.12</junit.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>ng</executable>
                <workingDirectory>src/main/resources/frontend/djl-app</workingDirectory>
                <arguments>
                    <argument>build</argument>
                </arguments>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- Deep Java Library -->
    <dependency>
        <groupId>ai.djl</groupId>
        <artifactId>api</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <dependency>
        <groupId>ai.djl</groupId>
        <artifactId>repository</artifactId>
        <version>${djl-repository.version}</version>
    </dependency>

    <!-- DJL silniki -->

    <dependency>
        <!-- pomaga poprawić błąd:No deep learning engine found exception. -->
        <groupId>ai.djl.mxnet</groupId>
        <artifactId>mxnet-native-auto</artifactId>
        <version>${djl-mxnet-native.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>ai.djl.mxnet</groupId>
        <artifactId>mxnet-engine</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <dependency> <!-- potrzebny zawsze native do działania engine'a -->
        <groupId>ai.djl.tensorflow</groupId>
        <artifactId>tensorflow-native-auto</artifactId>
        <version>${djl-tensorflow-native.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>ai.djl.tensorflow</groupId>
        <artifactId>tensorflow-engine</artifactId>
        <version>${djl.version}</version>
        <scope>runtime</scope>
    </dependency>

    <!-- DJL modele -->
    <dependency>
        <groupId>ai.djl</groupId>
        <artifactId>model-zoo</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <dependency>
        <groupId>ai.djl.mxnet</groupId>
        <artifactId>mxnet-model-zoo</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <dependency>
        <groupId>ai.djl.tensorflow</groupId>
        <artifactId>tensorflow-model-zoo</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <!-- Basic datasets -->
    <dependency>
        <groupId>ai.djl</groupId>
        <artifactId>basicdataset</artifactId>
        <version>${djl.version}</version>
    </dependency>

    <!-- Spring Boot -->
    <!-- ściąga djl.api w wersji startera -->
    <dependency>
        <groupId>ai.djl.spring</groupId>
        <artifactId>djl-spring-boot-starter-autoconfigure</artifactId>
        <version>${djl.starter.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <version>${spring-boot.version}</version>
        <optional>true</optional>
    </dependency>


    <!-- dodatkowe -->
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
    </dependency>

    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>${commons-cli.version}</version>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>${commons-csv.version}</version>
    </dependency>

    <dependency>
        <groupId>org.openpnp</groupId>
        <artifactId>opencv</artifactId>
        <version>${opencv.version}</version>
    </dependency>

    <dependency>
        <groupId>tech.tablesaw</groupId>
        <artifactId>tablesaw-core</artifactId>
        <version>${tablesaw-core.version}</version>
    </dependency>

    <dependency>
        <groupId>net.sf.dozer</groupId>
        <artifactId>dozer</artifactId>
        <version>${dozer.version}</version>
    </dependency>

    <!-- TEST -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

kkoripl avatar Jan 21 '21 21:01 kkoripl

@kkoripl TF SSD model output doesn't have a fixed order. You may need to specify output ndarray names. Please take a look: https://github.com/awslabs/djl/blob/master/tensorflow/tensorflow-model-zoo/src/main/java/ai/djl/tensorflow/zoo/cv/objectdetction/TfSsdTranslator.java#L157-L184

frankfliu avatar Jan 21 '21 21:01 frankfliu

There is still the problem and once again with indexes. I set proper names for boxes, classes and scores, but as you see downloaded model returns 4 elements in ndList instead of 3, so it will 100% throw exception from last else, when "num_detections" would get into the mix.

My translator:

        TfSsdTranslator translator = TfSsdTranslator.builder()
                .optThreshold(0.6f)
                .setPipeline(new Pipeline())
                .optSynsetUrl("path-to-synset")
                .optBoundingBoxOutputName("detection_boxes")
                .optClassLabelOutputName("detection_classes")
                .optScoresOutputName("detection_scores")
                .build();

image

I don't know that for sure, cause there is a problem earlier, with classes and their buffer. I got null when changing buffers. You're 100% sure, there suppose to be long buffer, not float one? As classes return like 1., 29. etc.

java.nio.BufferUnderflowException: null
	at org.tensorflow.ndarray.impl.buffer.Validator.readArgs(Validator.java:73) ~[tensorflow-api-0.9.0.jar:na]
	at org.tensorflow.ndarray.impl.buffer.raw.AbstractRawDataBuffer.read(AbstractRawDataBuffer.java:38) ~[tensorflow-api-0.9.0.jar:na]
	at org.tensorflow.ndarray.impl.buffer.raw.LongRawDataBuffer.read(LongRawDataBuffer.java:44) ~[tensorflow-api-0.9.0.jar:na]
	at ai.djl.tensorflow.engine.TfNDArray.toLongArray(TfNDArray.java:216) ~[tensorflow-engine-0.9.0.jar:na]
	at ai.djl.tensorflow.zoo.cv.objectdetction.TfSsdTranslator.processOutput(TfSsdTranslator.java:83) ~[tensorflow-model-zoo-0.9.0.jar:na]
	at ai.djl.tensorflow.zoo.cv.objectdetction.TfSsdTranslator.processOutput(TfSsdTranslator.java:33) ~[tensorflow-model-zoo-0.9.0.jar:na]
	at ai.djl.inference.Predictor.batchPredict(Predictor.java:163) ~[api-0.9.0.jar:na]
	at ai.djl.inference.Predictor.predict(Predictor.java:128) ~[api-0.9.0.jar:na]
	at djl.objectDetection.ObjectDetectionService.externalDetectObjects(ObjectDetectionService.java:55) ~[classes/:na]
	at djl.controller.ObjectDetectionController.detectExternal(ObjectDetectionController.java:32) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.33.jar:9.0.33]
	at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]

kkoripl avatar Jan 22 '21 08:01 kkoripl

@kkoripl I think there are bugs in TfSsdTranslator

  1. We should detect the datatype before assume it's INT64
  2. There might be more NDArray in the output then the code expected.

Can you share your model, so I can test it?

frankfliu avatar Jan 22 '21 18:01 frankfliu

@kkoripl I created a PR to address your issue: https://github.com/awslabs/djl/pull/555

Could you build DJL from source and test my PR?

frankfliu avatar Jan 22 '21 19:01 frankfliu