Giter Site home page Giter Site logo

多通道图片预处理BUG about dddd_trainer HOT 6 OPEN

sml2h3 avatar sml2h3 commented on June 16, 2024
多通道图片预处理BUG

from dddd_trainer.

Comments (6)

lazy-ape avatar lazy-ape commented on June 16, 2024 1

对于彩色的图片确实是这个问题,我改了一下,没有报错了,但是识别不出来内容,不知道是模型的问题,还是改的问题。
这个错误的原因应该是图片要 reshape 后传入模型,因为图片的shape 是 h, w, channel, 模型要求的是 channel, h, w。

我的代码改动如下,可以作为参考:

__init__.pyclassification 方法,第 1635 行增加以下代码

 if self.__channel == 3:
            image = np.asarray(image).astype(np.float32)
            old_shape = image.shape
            image = image.reshape(old_shape[0], old_shape[3], old_shape[1], old_shape[2])
            ort_inputs = {'input1': image}
  else:
            ort_inputs = {'input1': np.array([image]).astype(np.float32)}

from dddd_trainer.

ljyh223 avatar ljyh223 commented on June 16, 2024

请问问题解决了吗,我也遇到了

from dddd_trainer.

ztshun avatar ztshun commented on June 16, 2024

遇到了同样的问题,没解决

from dddd_trainer.

ztshun avatar ztshun commented on June 16, 2024

对于彩色的图片确实是这个问题,我改了一下,没有报错了,但是识别不出来内容,不知道是模型的问题,还是改的问题。 这个错误的原因应该是图片要 reshape 后传入模型,因为图片的shape 是 h, w, channel, 模型要求的是 channel, h, w。

我的代码改动如下,可以作为参考:

__init__.pyclassification 方法,第 1635 行增加以下代码

 if self.__channel == 3:
            image = np.asarray(image).astype(np.float32)
            old_shape = image.shape
            image = image.reshape(old_shape[0], old_shape[3], old_shape[1], old_shape[2])
            ort_inputs = {'input1': image}
  else:
            ort_inputs = {'input1': np.array([image]).astype(np.float32)}

试了,没报错,但是不能识别

from dddd_trainer.

ztshun avatar ztshun commented on June 16, 2024

INVALID_ARGUMENT : Invalid rank for input: input1 Got: 5 Expected: 4 Please fix either the inputs or the model

请问解决了吗

from dddd_trainer.

Qinlane avatar Qinlane commented on June 16, 2024

感谢
在 ort_outs = self.__ort_session.run(None, ort_inputs) 前面加上你的判断就可以了

from dddd_trainer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.