zhou13 / lcnn

LCNN: End-to-End Wireframe Parsing
MIT License
506 stars 94 forks source link

predict error #52

Closed carlsummer closed 3 years ago

carlsummer commented 3 years ago

为什么训练完预测 同样的图片 不同的batch_size 结果不一样

inputs = torch.cat(self.images)
images = inputs.to(self.device).half()
batchs = 8
with torch.no_grad():
    input_dict = {
        "image": images[:batchs],
        "meta": [
            {
                "junc": torch.zeros(1, 2).to(self.device).half(),
                "jtyp": torch.zeros(1, dtype=torch.uint8).to(self.device).half(),
                "Lpos": torch.zeros(2, 2, dtype=torch.uint8).to(self.device).half(),
            }
            for _ in range(batchs)
        ],
    }
    H = self.model(input_dict)["preds"]
    G = H["lines"][6]

batchs=7 或者8 或者10 得到的G 结果不一样

carlsummer commented 3 years ago

image

carlsummer commented 3 years ago

image

zhou13 commented 3 years ago

Are you sure you can reproduce this problem on the original repo? It seems you are using a heavily modified repo. Did you do model.eval()?

carlsummer commented 3 years ago

yes ,I use model.eval() ,but,I now find that although his results have changed, it does not affect the final coordinate value, which is similar to float32 and float64, but affects the latter few. I checked the information and found that it was a torch bug

zhou13 commented 3 years ago

Thanks for the update.