Net.fromTorch constructor

Net.fromTorch(
  1. String path, {
  2. bool isBinary = true,
  3. bool evaluate = true,
})

Reads a network model stored in Torch7 framework's format. https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga73785dd1e95cd3070ef36f3109b053fe

Implementation

factory Net.fromTorch(String path, {bool isBinary = true, bool evaluate = true}) {
  return using<Net>((arena) {
    final p = calloc<cdnn.Net>();
    final cpath = path.toNativeUtf8(allocator: arena).cast<ffi.Char>();
    cvRun(() => cdnn.Net_ReadNetFromTorch(cpath, isBinary, evaluate, p));
    final net = Net._(p);
    return net;
  });
}