Closed zheLim closed 4 years ago
BTW, It is not easy to do Mirror for image and mask at the same time. In my case CropMirrorNorm output wrong mask(i.e. value in msak is not 0/1). FastResizeCrop cannot be used, since mask require resize with inter_NN.
I'm currently reworking all warping operators (rotate, warp affine, etc). New rotate will enlarge canvas to accommodate whole image, while new WarpAffine will accept externally provided canvas size. It should be available quite soon, but I can't commit to any particular release. Using paste + warp/rotate is possible, but quite wasteful.
@mzient Looking forward to your later commit!
I have the same needs,is there any new solution now?
Hi, Reworked WarpAffine operator is already available in the master branch and you can try is by installing the nightly build of DALI. An example of how it works can be found https://docs.nvidia.com/deeplearning/sdk/dali-master-branch-user-guide/docs/examples/warp.html. @mzient anything to add?
Regarding rotate: the new rotate automatically adjusts canvas size to fit the image. Just download the new version and you're set. You can reuse the angles tensor for images and masks, too. If you need more than just rotation, you can use WarpAffine, but that leaves you on your own with calculating the matrix elements and output sizes. I guess some solution can be hacked together with the combination of ExternalSource for base transform matrices and incorporating the input sizes with the newly-added arithmetic operators (see https://docs.nvidia.com/deeplearning/sdk/dali-master-branch-user-guide/docs/examples/expressions.html) and Shapes operator. If the images at the input to WarpAffine are of uniform size, you can simply calculate the sizes and matrices in python and just feed them to the pipeline through external source.
This change is available in DALI 0.16.0.
Hi, i would like to create random rotate/warpaffine operator without cropping side like OpenCV Python : rotate image without cropping sides. Firstly I suppose it can be done using Paste+rotate. However, random parameter pass to rotate operator cannot be known. Thus I cannot do padding before rotate. Any suggestion on this problem?