A computer-implemented method for identifying plant species in an agricultural field using a dual task convolutional neural network having a topology with: an intermediate module configured for executing a first task in determining plant species (11, 12, 13) which are present on a test input image, the first task being associated with a first loss function, and a semantic segmentation module configured for executing a second task in segmenting the test input image to determine a class for each pixel of the test input image, the classes comprising the determined plant species, the second task associated with a second different loss function, wherein the intermediate module and the segmentation module being trained together, taking into account the first and second loss functions (LF1, LF2); the method comprising: receiving a test input comprising an image showing plants of a plurality of plant species in an agricultural field; extracting tiles from the test input image, the tiles having the dimensions of the input shape of the intermediate module; for each extracted tile: the intermediate module predicting the presence of one or more plant species which are present in the respective tile; the intermediate module outputting a corresponding intermediate feature map (121-o1) to the segmentation module as output of the first task; the segmentation module generating a mask for each plant species class as segmentation output of the second task by extracting multiscale features and context information from the intermediate feature map and concatenating the extracted information to perform semantic segmentation, the mask being an image having the same size as a tile where each pixel on the mask is associated with a value representing the probability for said pixel to belong to the associated class; and combining the generated masks into a final image indicating for each pixel if it belongs to a particular plant species, and if so, to which plant species it belongs. an intermediate module configured for executing a first task in determining plant species (11, 12, 13) which are present on a test input image, the first task being associated with a first loss function, and a semantic segmentation module configured for executing a second task in segmenting the test input image to determine a class for each pixel of the test input image, the classes comprising the determined plant species, the second task associated with a second different loss function, wherein the intermediate module and the segmentation module being trained together, taking into account the first and second loss functions (LF1, LF2); receiving a test input comprising an image showing plants of a plurality of plant species in an agricultural field; extracting tiles from the test input image, the tiles having the dimensions of the input shape of the intermediate module; for each extracted tile: the intermediate module predicting the presence of one or more plant species which are present in the respective tile; the intermediate module outputting a corresponding intermediate feature map (121-o1) to the segmentation module as output of the first task; the segmentation module generating a mask for each plant species class as segmentation output of the second task by extracting multiscale features and context information from the intermediate feature map and concatenating the extracted information to perform semantic segmentation, the mask being an image having the same size as a tile where each pixel on the mask is associated with a value representing the probability for said pixel to belong to the associated class; and the intermediate module predicting the presence of one or more plant species which are present in the respective tile; the intermediate module outputting a corresponding intermediate feature map (121-o1) to the segmentation module as output of the first task; the segmentation module generating a mask for each plant species class as segmentation output of the second task by extracting multiscale features and context information from the intermediate feature map and concatenating the extracted information to perform semantic segmentation, the mask being an image having the same size as a tile where each pixel on the mask is associated with a value representing the probability for said pixel to belong to the associated class; and combining the generated masks into a final image indicating for each pixel if it belongs to a particular plant species, and if so, to which plant species it belongs.