Skip to main content
Associate
August 20, 2026
Question

NBG generation fails ("Generation does not contain any output") for custom MobileNetV2 on STM32MP257, but succeeds for ST Model Zoo MobileNet

  • August 20, 2026
  • 1 reply
  • 46 views

Board: STM32MP257F-EV1 (also relevant to STM32MP257F-DK)
Tool: ST Edge AI Developer Cloud, ST Edge AI Core 2.2.0

The "Optimize" step (NBG generation) consistently fails with:
"Error while generating optimized file. Generation does not contain any output."

Model details:
- Architecture: torchvision.models.mobilenet_v2(weights=None, num_classes=100)
- Trained from scratch on CIFAR-100 (100 classes), PyTorch 2.5.1+cu121
- Input: 3x224x224, output: 100 classes
- Quantized on-platform to INT8, per-tensor (per-channel disabled)

Attempts (all fail identically):
1. Original export, opset_version=12
2. Simplified via onnx-simplifier (0.4.36) - only reduced redundant Constant nodes (176->108); Conv/Clip/Add/Gemm counts unchanged
3. Re-exported with opset_version=17
4. All used random-value calibration (no .npz calibration dataset provided)

No "Show terminal" or detailed log option appears for this specific error on the Optimize step.

Control test (works fine):
Imported mobilenet_a050_pt_224_qdq_int8_image_classification_imagenet.onnx from ST Model Zoo (MobileNet 0.5, 1000 classes, INT8) through the identical pipeline - NBG succeeded, benchmarked at 4.35 ms on STM32MP257F-EV1.

Question:
What's different about a torchvision-exported MobileNetV2 graph that could cause silent NBG failure? Is there a known list of unsupported ops/patterns for STM32MP2 NBG compilation, or a way to get more detailed compiler diagnostics than the web UI shows? Happy to attach the .onnx file or graph screenshots if useful.

1 reply

Associate
August 21, 2026

Update: Found a working workaround.

Root cause appears to be specific to the direct PyTorch -> ONNX export 
path, not the STM32MP257 hardware or NBG toolchain itself.

Workaround pipeline that works:
PyTorch -> ONNX -> onnx2tf (ONNX to TensorFlow SavedModel) -> 
ST's tflite_quant.py script (per-channel INT8, fake/random calibration) 
-> TFLite -> ST Edge AI Developer Cloud Optimize (NBG) -> SUCCESS

NBG generation succeeded on the TFLite model, and it benchmarked at 
11.03 ms on STM32MP257F-EV1 for our 100-class MobileNetV2 
classification model.

For reference, the same architecture via direct ONNX export (opset 12 
and opset 17 both tried, simplified and unsimplified) consistently 
failed NBG generation with "Generation does not contain any output."

This suggests the ONNX export path (at least via torch.onnx.export) 
may have compatibility issues with the NBG compiler that the 
TFLite/onnx2tf path avoids. Posting this in case it helps others 
hitting the same error.

Credit to OKN's thread for the TFLite workaround idea, originally 
found for YOLOv8n - can confirm it also works for classification 
models like MobileNetV2: