Select to view content in your preferred language

Detect Objects Using Deep Learning error: Python raster function is unable to vectorize the data

214
1
3 weeks ago
AdamSilberfein
New Contributor

I'm having the same issue discussed here but I'm unable to find a workaround. I've attached the full error, but I think it boils down to this line of code:

File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\fastai\vision\image.py", line 560, in _affine_grid    N, C, H, W = size    ^^^^^^^^^^ValueError: not enough values to unpack (expected 4, got 3)Python Raster Function's .vectorize() method returned nothing.

I am running ArcGIS Pro 3.5.4 and have a model trained with Pascal VOC metadata format. This error occurs regardless of which model type I run (e.g. Faster R-CNN, RetinaNet, MMDetection, etc.). Using the same training data and a model with RCNN Masks metadata format, I have no issues detecting objects using Mask R-CNN. I'd just like to run some of the other model types for comparison.

I've tried updated some of the relevant packages in Package Manager, since several of them are not using the latest, but it seems there are dependencies preventing me from getting newer versions.

Is anyone able to offer advice here? Thanks in advance!

0 Kudos
1 Reply
Robert_LeClair
Esri Esteemed Contributor

Here's some information I learned from reviewing other cases:

That message is coming from the Python Raster Function / deep learning model code (fastai/PyTorch), and it indicates your model (or the raster function calling it) passed an input with the wrong shape into an affine/warping step:

  • ValueError: not enough values to unpack (expected 4, got 3) at fastai.vision.image._affine_grid means the code expected a 4D tensor size (N, C, H, W) (batch, channels, height, width) but received only 3 values (typically (C, H, W) or (H, W, C)), so it can’t proceed.

  • The trailing message “Python Raster Function's .vectorize() method returned nothing” means the raster function’s vectorization step produced no features (often because inference failed earlier due to the shape error, or because the result was empty), so the geoprocessing tool can’t generate an output feature class/table.
  • If this happened while running Detect Objects Using Deep Learning / similar deep learning tools in ArcGIS Pro 3.5.x, there is a related known issue where vectorization fails after the python raster function step:  BUG-000182421 for ArcGIS Pro
0 Kudos