Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • otbtf otbtf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

La forge institutionnelle d'INRAE étant en production depuis le 10 juin 2025, nous vous invitons à y créer vos nouveaux projets.

  • Cresson Remi
  • otbtfotbtf
  • Issues
  • #7
Closed
Open
Issue created Oct 22, 2021 by Cresson Remi@remi.cressonOwner

Improve handling of 3-dimensional output tensors + more explanation in error messages about output tensors dimensions

Problem

We face a (FATAL) TensorflowModelServe: Caught std::exception during application execution: std::bad_alloc when the output tensors of a model are not in the right shape (i.e. the last component is not the number of channels). While this is nominal that the error occurs, we should be able to explain the user why, instead of having this incomprehensible std::bad_alloc message 😉

How to reproduce

Model:

import tensorflow as tf

# Input
x = tf.keras.Input(shape=[None, None, None], name="x")  # [1, h, w, N]

# Compute norm on the last axis
y = tf.norm(x, axis=-1)

# Create model
model = tf.keras.Model(inputs={"x": x}, outputs={"y": y}, name="my_model")
model.save("my_model")

Inference:

We run the model in fully convolutional, meaning that the input image is processed in blocks of [1, h, w, N].

otbcli_TensorflowModelServe \
-source1.il sr4rs_data/input/SENTINEL2B_20200929-104857-489_L2A_T31TEJ_C_V2-2_FRE_10m.tif \
-model.dir my_model/ -out norm.tif -model.fullyconv on

What to tell to the user instead?

Explain him how to arrange output tensor dimensions. It is already in the doc but the point is to have some explicit warning/error message/suggestion message

Improve OTBTF to work with dimension-3 tensors

We can assume that 3-dimensional tensors are always [batch, h, x]. I don't see why a model would produce otherwise.

Edited Nov 06, 2021 by Cresson Remi
Assignee
Assign to
Time tracking