This commit is contained in:
Glenn Jocher 2019-07-09 14:18:19 +02:00
parent bb1e551150
commit 9c227dd2b4
3 changed files with 14 additions and 2 deletions

View File

@ -36,4 +36,4 @@ paste <(awk "{print \"$PWD\"}" <trainvalno5k.part) trainvalno5k.part | tr -d '\t
# sudo rm -rf train_images/._*
# lastly convert each .tif to a .bmp for faster loading in cv2
# /home/glenn_jocher3/coco/images/train2014/COCO_train2014_000000167126.jpg # bad image??
# ./coco/images/train2014/COCO_train2014_000000167126.jpg # corrupted image

View File

@ -1,5 +1,7 @@
# pip3 install -U -r requirements.txt
# conda install numpy opencv matplotlib tqdm pillow && conda install pytorch torchvision -c pytorch
# conda install numpy opencv matplotlib tqdm pillow
# conda install pytorch torchvision -c pytorch
# conda install -c conda-forge scikit-image
numpy
opencv-python
torch >= 1.1.0

View File

@ -223,6 +223,16 @@ class LoadImagesAndLabels(Dataset): # for training/testing
pass # print('Warning: missing labels for %s' % self.img_files[i]) # missing label file
assert len(np.concatenate(self.labels, 0)) > 0, 'No labels found. Incorrect label paths provided.'
# Detect corrupted images https://medium.com/joelthchao/programmatically-detect-corrupted-image-8c1b2006c3d3
detect_corrupted_images = False
if detect_corrupted_images:
from skimage import io # conda install -c conda-forge scikit-image
for file in tqdm(self.img_files, desc='Detecting corrupted images'):
try:
_ = io.imread(file)
except:
print('Corrupted image detected: %s' % file)
def __len__(self):
return len(self.img_files)