graviti
产品服务
解决方案
知识库
公开数据集
关于我们
Diabetic Retinopathy (resized)
2D Classification
Aesthetics
|...
许可协议: CC-BY-SA 4.0

Overview

Diabetic Retinopathy Detection Competition Dataset Resized/Cropped

In this dataset, I have included both a resized version of the dataset, and a cropped then resized version of the data.

trainLabels.csv

This file contains the name of the file under the 'image' column and the label under the 'level' column.

resized_train:

This folder was created by simply resizing the dataset to 1024x1024 if it is bigger than this size, else it remains the same.
The code used to create this dataset is:

import glob
import os
from tqdm import tqdm
import math
from PIL import Image 
files = glob.glob('D:\\Experiments with Deep Learning\\DR Kaggle\\train\\train\\train\\*.jpeg')

new_width = 1024

for i in tqdm(range(len(files))):
    img = Image.open(files[i])
    width,height = img.size
    ratio = height/width
    if width > new_width:
        new_image = img.resize((new_width,math.ceil(ratio*new_width)))   
    else:
        new_image = img
    new_image.save('D:\\Experiments with Deep Learning\\DR 
Kaggle\\train\\train\\resized_train\\'+os.path.basename(files[i]))

`

resized_train_cropped:

In this case, as much of the black space is cropped out by trying to identify the center and radius of the circle of the fundus image. Some of the images turned out to be fully black or very close to fully black, and no mask was found. Hence, those images were manually removed. There may still be some noisy images remaining, however.

The code used to create this dataset is:

# import the necessary packages
import numpy as np
import cv2
import glob
import os
from tqdm import tqdm
import math
from PIL import Image
files = glob.glob('D:\\Experiments with Deep Learning\\DR Kaggle\\train\\train\\train\\*.jpeg')

new_sz = 1024

def crop_image(image):
    output = image.copy()
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    ret,gray = cv2.threshold(gray,10,255,cv2.THRESH_BINARY)
    contours,hierarchy = cv2.findContours(gray,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    if not contours:
        print('no contours!')
        flag = 0
        return image, flag
    cnt = max(contours, key=cv2.contourArea)
    ((x, y), r) = cv2.minEnclosingCircle(cnt)
    x = int(x); y = int(y); r = int(r)
    flag = 1
    #print(x,y,r)
    if r > 100:
        return output[0 + (y-r)*int(r
数据概要
数据格式
image,
数据量
70.236K
文件大小
928.16MB
发布方
ilovescience
| 数据量 70.236K | 大小 928.16MB
Diabetic Retinopathy (resized)
2D Classification
Aesthetics
许可协议: CC-BY-SA 4.0

Overview

Diabetic Retinopathy Detection Competition Dataset Resized/Cropped

In this dataset, I have included both a resized version of the dataset, and a cropped then resized version of the data.

trainLabels.csv

This file contains the name of the file under the 'image' column and the label under the 'level' column.

resized_train:

This folder was created by simply resizing the dataset to 1024x1024 if it is bigger than this size, else it remains the same.
The code used to create this dataset is:

import glob
import os
from tqdm import tqdm
import math
from PIL import Image 
files = glob.glob('D:\\Experiments with Deep Learning\\DR Kaggle\\train\\train\\train\\*.jpeg')

new_width = 1024

for i in tqdm(range(len(files))):
    img = Image.open(files[i])
    width,height = img.size
    ratio = height/width
    if width > new_width:
        new_image = img.resize((new_width,math.ceil(ratio*new_width)))   
    else:
        new_image = img
    new_image.save('D:\\Experiments with Deep Learning\\DR 
Kaggle\\train\\train\\resized_train\\'+os.path.basename(files[i]))

`

resized_train_cropped:

In this case, as much of the black space is cropped out by trying to identify the center and radius of the circle of the fundus image. Some of the images turned out to be fully black or very close to fully black, and no mask was found. Hence, those images were manually removed. There may still be some noisy images remaining, however.

The code used to create this dataset is:

# import the necessary packages
import numpy as np
import cv2
import glob
import os
from tqdm import tqdm
import math
from PIL import Image
files = glob.glob('D:\\Experiments with Deep Learning\\DR Kaggle\\train\\train\\train\\*.jpeg')

new_sz = 1024

def crop_image(image):
    output = image.copy()
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    ret,gray = cv2.threshold(gray,10,255,cv2.THRESH_BINARY)
    contours,hierarchy = cv2.findContours(gray,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    if not contours:
        print('no contours!')
        flag = 0
        return image, flag
    cnt = max(contours, key=cv2.contourArea)
    ((x, y), r) = cv2.minEnclosingCircle(cnt)
    x = int(x); y = int(y); r = int(r)
    flag = 1
    #print(x,y,r)
    if r > 100:
        return output[0 + (y-r)*int(r
0
立即开始构建AI
graviti
wechat-QR
长按保存识别二维码,关注Graviti公众号

Copyright@Graviti
沪ICP备19019574号
沪公网安备 31011002004865号