Giter Site home page Giter Site logo

Comments (8)

LiheYoung avatar LiheYoung commented on June 22, 2024

一般来说是因为人工标注的mask中存在比网络输出的类别数 (configs中的nclass)更大的类别(准确来说是大于或等于)。比如如果你的nclass设置的是21,但是mask中存在25这样的类别index,那就会报这样的错,需要检查一下mask。

from unimatch.

youngprogrammerBee avatar youngprogrammerBee commented on June 22, 2024

感谢您的回复,我的mask做灰度图读入后应该只有背景和血管两个类,好奇怪

from unimatch.

LiheYoung avatar LiheYoung commented on June 22, 2024

可以print(torch.unique(mask))确认一下是否只有0和1。

from unimatch.

youngprogrammerBee avatar youngprogrammerBee commented on June 22, 2024

非常感谢您的回复
改了半天发现是我mask在transform.resize后改了像素值,原来取值只有0,255(黑色和白色)的像素变了,改完后现在输出的print(`torch.unique(torch.from_numpy(mask).long()))结果是tensor([ 0, 255])(不是0,1会影响吗) ,然后我修改了nclass为2然后还是报错
image

from unimatch.

LiheYoung avatar LiheYoung commented on June 22, 2024

需要将255的像素改成1才行

from unimatch.

youngprogrammerBee avatar youngprogrammerBee commented on June 22, 2024

您好 感谢您的回复,将255的像素改为1之后确实成功开始了训练。 我在用得到的模型进行test时候,发现得到的output是两通道的(torch.size[1,2,480,480]),请问这样是否正常?

from unimatch.

LiheYoung avatar LiheYoung commented on June 22, 2024

对的

from unimatch.

youngprogrammerBee avatar youngprogrammerBee commented on June 22, 2024

您好,我在对预测的图像尝试转换为正常模型时,
image
发现argmax后的tensor全部为1,
image
发现是因为两个通道总是有一个通道的像素比另外一个的大,后来放弃使用argmax而是直接将两个通道的值相加后*255,发现出来的结果基本能还原轮廓但是很奇怪,请问您有试过将预测的结果转换成图像吗?有遇到类似问题吗

from unimatch.

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.