deephealthproject / eddl

European Distributed Deep Learning (EDDL) library. A general-purpose library initially developed to cover deep learning needs in healthcare use cases within the DeepHealth project.
https://deephealthproject.github.io/eddl/
MIT License
34 stars 10 forks source link

DeepLabv3+ - Tensors with different size (Tensor::copy) #295

Closed MicheleCancilla closed 3 years ago

MicheleCancilla commented 3 years ago

I noticed that develop branch gained dilated convolution functionality, so I tried to import a DeepLabV3+ onnx (exported from PyTorch and then simplified) but EDDL throws an error during import at runtime on conv_66.

Test main:

int main(int argc, char** argv)
{
    int epochs = 2;
    string path("DeepLabV3Plus_resnet18_simpl.onnx");

    // Import resnet18 model and reshape input for cifar
    Net* net = import_net_from_onnx_file(path, { 3, 224, 224 });

    // Build model
    build(net,
        adam(0.0001),              // Optimizer
        { "bce" }, // Losses
        { "mse" },  // Metrics
        CS_GPU({ 1 }, "low_mem"),  // Computing service (CPU or GPU)
        false                      // Parameter that indicates that the weights of the net must not be initialized to random values.
    );

    summary(net);

    // Load training data
    Tensor* x_train = Tensor::randn({ 128, 3, 224, 224 });
    Tensor* y_train = Tensor::randn({ 128, 1, 224, 224 });

    // Train few epochs the new layers
    fit(net, { x_train }, { y_train }, 1, epochs);

    return EXIT_SUCCESS;
}

ONNX file link: download

Could you please check what is wrong with this model?

chavicoski commented 3 years ago

Ok, I will check it. Thanks!

chavicoski commented 3 years ago

The problem is that the model also uses grouped convolutions, which are not implemented. For example, the layer "Conv_69" is grouped with 512 groups.

MicheleCancilla commented 3 years ago

🤦🏻‍♂️ I didn't notice that... I will try a model with standard convolutions then. Thanks, @chavicoski