Open DejaVuyan opened 2 years ago
Solved
Solved
您好,请问如何解决的。
我是直接读取RGB(复制2个通道)然后获取单个通道,即img[:,:,0]
但是在做扩增时会有问题,不清楚为什么源码里面augment采用了cv2.flip(img, 1, img)
多了一个参数导致的,我修改了可以。
def _augment(img):
if hflip: # horizontal
cv2.flip(img, 1, img)
if vflip: # vertical
cv2.flip(img, 0, img)
if rot90:
img = img.transpose(1, 0, 2)
return img
伊
您好,请问如何解决的。
我是直接读取RGB(复制2个通道)然后获取单个通道,即这样
img[:,:,0]
做会增加成本时会有问题,鉴于源码里面增加成本cv2.flip(img, 1, img)
参数导致的,我修改了可以。def _augment(img): if hflip: # horizontal cv2.flip(img, 1, img) if vflip: # vertical cv2.flip(img, 0, img) if rot90: img = img.transpose(1, 0, 2) return img
- 我想这个问题,谢谢
basicsr.utils里的imfrombytes函数中,有个参数flag,传入grayscale,即可读入灰度图片,但是读入的图片维度只有二维,即丢失了通道维度,如果你需要通道维度的的话可以使用numpy的维度扩展函数np.expand_dims即可
我的数据集由灰度图像组成,但是我没有找到怎样让图片按照灰度图像读取(读取的图片通道为1),调整config文件中的num_in_ch也只能调整构造的网络输入通道,读取图片的通道仍然为3。
My dataset consists of grayscale images, but I have not found how to make the images read as grayscale images (the image read channel is 1), adjusting num_in_CH in the config file can only adjust the constructed network input channel, the image read channel is still 3.