Model with multiple layers output
Closed this issue · 4 comments
tb-vhbc commented
bartoszptak commented
Hi @tb-vhbc ,
You didn't attached configuration from the deepness window, so I can only suppose what could be wrong. If you train ULTRALYTICS yolov8 model for instance segmentation, you should use model type: Detector instead od Segmentor. Let me know if that helps you. Otherwise provide a screenshot of the deepness window, please
przemyslaw-aszkowski commented
Hi,
If the above doesn't help, maybe it is something we saw earlier. Before exporting to ONNX, create a wrapper which selects only one output:
import torch
import torch.nn
class NewModel(nn.Module):
def __init__(self, m):
super().__init__()
self.m = m
def forward(self, x):
x = self.m(x)
return x['out']
model_new = NewModel(model)
x = torch.rand([1, 3, 256, 256])
_ = model_new(x)
tb-vhbc commented
Hi @bartoszptak
Below are the captures of deepness window :
And this the error output from QGIS :
NotImplementedError: Model with multiple output layers is not supported! Use only one output layer.
Traceback (most recent call last):
File "C:\Users/tb-vhbc/AppData/Roaming/QGIS/QGIS3\profiles\test-segmentation/python/plugins\deepness\deepness_dockwidget.py", line 264, in _browse_model_path
self._load_model_and_display_info()
File "C:\Users/tb-vhbc/AppData/Roaming/QGIS/QGIS3\profiles\test-segmentation/python/plugins\deepness\deepness_dockwidget.py", line 385, in _load_model_and_display_info
self._update_model_output_format_mapping()
File "C:\Users/tb-vhbc/AppData/Roaming/QGIS/QGIS3\profiles\test-segmentation/python/plugins\deepness\deepness_dockwidget.py", line 393, in _update_model_output_format_mapping
for output_number in range(self._model.get_number_of_output_channels()):
File "C:\Users/tb-vhbc/AppData/Roaming/QGIS/QGIS3\profiles\test-segmentation/python/plugins\deepness\processing\models\segmentor.py", line 77, in get_number_of_output_channels
raise NotImplementedError("Model with multiple output layers is not supported! Use only one output layer.")
NotImplementedError: Model with multiple output layers is not supported! Use only one output layer.
Version de Python : 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
Version de QGIS : 3.32.1-Lima Lima, 4a078ecf63
przemyslaw-aszkowski commented
Hi, as Bartosz wrote, please use Detector
instead od Segmentor
model type