initYolox method

Future<void> initYolox({
  1. required String modelPath,
  2. required String paramPath,
  3. bool autoDispose = true,
  4. double nmsThresh = yoloxNmsThreshDefault,
  5. double confThresh = yoloxConfThreshDefault,
  6. int targetSize = yoloxTargetSizeDefault,
})

Initialize YOLOX Run it for the first time

  • modelPath - path to model file. like "assets/yolox.bin"
  • paramPath - path to parameter file. like "assets/yolox.param"
  • autoDispose - If true, multiple calls to initYolox will automatically dispose of recently loaded model.
  • nmsThresh NMS threshold.
  • confThresh Threshold of bounding box prob.
  • targetSize Target image size after resize, might use 416 for small model.

Implementation

Future<void> initYolox({
  required String modelPath,
  required String paramPath,
  bool autoDispose = true,
  double nmsThresh = yoloxNmsThreshDefault,
  double confThresh = yoloxConfThreshDefault,
  int targetSize = yoloxTargetSizeDefault,
}) async {
  assert(nmsThresh > 0);
  assert(confThresh > 0);
  assert(targetSize > 0);

  if (autoDispose) {
    dispose();
  }
  _nmsThresh = nmsThresh;
  _confThresh = confThresh;
  _targetSize = targetSize;

  final tempModelPath = (await _copy(modelPath)).toNativeUtf8();
  final tempParamPath = (await _copy(paramPath)).toNativeUtf8();

  _initYoloxFunction(
    tempModelPath,
    tempParamPath,
  );
  calloc
    ..free(tempModelPath)
    ..free(tempParamPath);
}