setActiveModels method

Future<void> setActiveModels({
  1. bool? detect,
  2. bool? classify,
  3. bool? secondDetect,
})

Enable/disable individual models' per-frame inference at runtime. All predictors stay loaded in memory, so toggling is instant with no reload — use it to cut inference load by running only the models a given phase needs. detect = primary detect, classify = classify model, secondDetect = the second detect model. Pass null to leave unchanged.

Implementation

Future<void> setActiveModels({
  bool? detect,
  bool? classify,
  bool? secondDetect,
}) async {
  final ch = _channel;
  if (ch == null) return;
  await ch.invokeMethod<void>('setActiveModels', {
    if (detect != null) 'detect': detect,
    if (classify != null) 'classify': classify,
    if (secondDetect != null) 'secondDetect': secondDetect,
  });
}