Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
otb
otb
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 292
    • Issues 292
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Main Repositories
  • otbotb
  • Issues
  • #2133

Closed
Open
Opened Feb 01, 2021 by Cédric Traizet@ctraizetDeveloper

Wrong input layer size in TrainImagesRegression using the ANN classifier

Description

This bug was reported by a user on the forum

The input layer of the output model produced TrainImagesRegression when using the artificial neural network classifier (ann) always has a size of 1, when it should match the number of bands of the input image. The training does not fail, and a mse is computed. However awhen trying to use the model with ImageRegression an error is thrown by OpenCV:

(FATAL) ImageRegression: itk::ERROR: MultiThreader(000001D5109CC040): Exception occurred during SingleMethodExecute OpenCV(4.1.1) C:\build\otb\build\OPENCV\src\OPENCV\modules\ml\src\ann_mlp.cpp:350: error: (-215:Assertion failed) (type == CV_32F || type == CV_64F) && inputs.cols == layer_sizes[0] in function ‘cv::ml::ANN_MLPImpl::predict’

Note that training an artificial neural network model with TrainVectorRegression works correctly, so the problem is likely located in TrainImagesRegression. Also note that TrainImagesClassifier works correctly whn trying to train an artificial neural network for classification.

Steps to reproduce

otbcli_TrainImagesRegression -io.il input.tif -io.ip "predicted_values.tif"  -io.out model.txt -classifier ann -classifier.ann.sizes 10 
otbcli_ImageRegression  -in input.tif  -model model.txt  -out out.tif 

leads to the following model :

%YAML:1.0
---
opencv_ml_ann_mlp:
  format: 3
  layer_sizes: [ 1, 10, 1 ]
[...]

but the input image has 4 bands.

Configuration information

OTB 7.2, reproduced on Windows 10 and Ubuntu 16.04

Edited Feb 01, 2021 by Julien Osman
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: orfeotoolbox/otb#2133