yizhezhang2000/SAMAug

How do I use my own dataset on my SAMAug.py?

Closed this issue · 3 comments

How do I use my own dataset on SAMAug.py?That has neither an input file path nor an output file path.

Hi, thanks for your interests.

The function SAMAug takes an image and the SAM mask generator as its input, and outputs the SAM-augmented image. Given an image path (say "xyz.jpg"), one can use "tI=skimage.io.imread('xyz.jpg')" to read the image, and call the function SAMAug for the augmentation.

嗨,感谢您的关注。

函数 SAMAug 将图像和 SAM 掩码生成器作为其输入,并输出 SAM 增强图像。给定一个图像路径(比如“xyz.jpg”),可以使用“tI=skimage.io.imread('xyz.jpg')”来读取图像,并调用函数SAMAug进行扩充。

Good, thank you for your reply.But how do I get the output image?And if I want to use folders, how should I use them?

Hi, you may use functions such as "skimage.io.imsave" to save the "tI" after augmentation (skimage.io.imsave(savepath, 255*tI)).

Note that after augmentation, some values of (255*tI) may exceed 255, skimage.io.save would normalize the values to make all the values between 0 and 255 before saving the file. You may have some additional functions to normalize the values before calling the imsave function so that the normalization part is in your control. Hope this makes sense. Thank you.