Thread group count is above the maximum allowed limit

Hi, I am trying out a pre-trained model (https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/duc)

But I keep getting an error that the thread group is above the maximum allowed limit.
Any tips or direction on how I could fix it?

Error

Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.
UnityEngine.ComputeShader:smile:ispatch(Int32, Int32, Int32, Int32)
Barracuda.ComputeFunc:smile:ispatch(Int32, Int32, Int32) (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/BarracudaReferenceCompute.cs:1422)
Barracuda.ComputeFunc:smile:ispatch(Int32[]) (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/BarracudaReferenceCompute.cs:1408)
Barracuda.ComputeKernel:smile:ispatch() (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/BarracudaCompute.cs:435)
Barracuda.ComputeOps:Softmax(Tensor) (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/BarracudaCompute.cs:847)
Barracuda.StatsOps:Barracuda.IOps.Softmax(Tensor) (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/StatsOps.cs:209)
Barracuda.<ExecuteAsync>d__27:MoveNext() (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/GenericWorker.cs:587)
Barracuda.GenericWorker:Execute() (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/GenericWorker.cs:117)
Barracuda.GenericWorker:Execute(IDictionary`2) (at Library/PackageCache/com.unity.barracuda@0.4.0-preview/Barracuda/Core/Backends/GenericWorker.cs:105)
<Working>d__10:MoveNext() (at Assets/Scripts/ModelTester.cs:59)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Script

using Barracuda;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ModelTester : MonoBehaviour
{
    private const string INPUT_NAME = "data";

    [SerializeField]
    private NNModel modelFile;

    [SerializeField]
    private Texture2D texture;

    private IWorker worker;

    private void Start() {
        Model model = ModelLoader.Load(this.modelFile, false);

        this.worker = WorkerFactory.CreateWorker(WorkerFactory.Type.ComputePrecompiled, model);
        StartCoroutine(Working());
    }

    private IEnumerator Working() {
        Debug.Log("Starting");
        yield return new WaitForSeconds(1);

        using (var tensor = new Tensor(texture)) {
            Dictionary<string, Tensor> inputs = new Dictionary<string, Tensor>();

            try {
                inputs.Add(INPUT_NAME, tensor);

                this.worker.Execute(inputs);
            } catch (Exception ex) {
                Debug.LogError(ex);
            }

            // Do stuff with the result
            Debug.Log("Done");
        }
    }
}

We don’t support non-ML-Agents models with Barracuda on this forum, but you can try posting on the Barracuda Github here: GitHub - Unity-Technologies/barracuda-release

1 Like

Thanks! will do that