I want to deploy a model with C++ on TVM, and I want to do Image Processing (ops like resize, load jpeg) without OpenCV, what should I do ? thanks all!
For resize and image loading, you could try skia. Its c++ and cross platform.
But for setting inputs on some networks…i’m unsure if skia has any helper methods to convert to formats that are needed. For instance, i use some models that are R(float32)G(float32)B(float32)
, and require planar (rrrbbbggg vs rgbrgbrgb) layout. I’m not aware of libraries that have this functionality and would probably write that by hand.
OTOH, opencv has a built in function to convert formats, blobFromImage
.
With my projects, I statically compile in opencv, so i’m left with a single ~20meg library(.so/dll).
@fourmi1995, my two cents.
In my opinion, you are trying to resolve a problem not directly related to TVM. How data are prepared/pre-processed isn’t necessarily part of TVM pipeline. You have to identify your deployment environment and then try to find a solution. For example, on a bare-metal system, there’s no OS, no file system and probably very few c-lib APIs available, you’ll have to write very low-level C code to get your data; on the contrary, a full-fledged Linux system has a whole lot more library available other than OpenCV to leverage.
said that, I do see relay has some algorithm and image processing APIs defined, Theoretically you can create OPs involved in image pre-processing, defining the compute and schedule for each of them, then stitching up your pipeline inside Relay/TVM. I guess it is a lot of work though and probably not necessary to be done in TVM.