Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Mapping and Deeplab #9

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dataset/Half_Circle_O/annotations_summary.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Object_Name,Image_Path,X,Y,Width,Height,Img_Width,Img_Height
Half_Circle_O,Half_Circle_O_img_0.jpg,266,208,18,28,448,448
Half_Circle_O,Half_Circle_O_img_1.jpg,363,279,26,22,448,448
Half_Circle_O,Half_Circle_O_img_2.jpg,231,293,37,26,448,448
Half_Circle_O,Half_Circle_O_img_3.jpg,163,213,22,30,448,448
Half_Circle_O,Half_Circle_O_img_4.jpg,61,260,61,43,448,448
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Dataset/Heart_O/annotations_summary.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Object_Name,Image_Path,X,Y,Width,Height,Img_Width,Img_Height
Heart_O,Heart_O_img_0.jpg,258,204,29,28,448,448
Heart_O,Heart_O_img_1.jpg,356,271,28,28,448,448
Heart_O,Heart_O_img_2.jpg,225,282,38,39,448,448
Heart_O,Heart_O_img_3.jpg,162,207,32,31,448,448
Heart_O,Heart_O_img_4.jpg,50,241,63,66,448,448
Binary file added Dataset/Heart_O/images/Heart_O_img_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/images/Heart_O_img_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/images/Heart_O_img_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/images/Heart_O_img_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/images/Heart_O_img_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/masks/Heart_O_img_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/masks/Heart_O_img_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/masks/Heart_O_img_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/masks/Heart_O_img_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_O/masks/Heart_O_img_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Dataset/Heart_W/annotations_summary.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Object_Name,Image_Path,X,Y,Width,Height,Img_Width,Img_Height
Heart_W,Heart_W_img_0.jpg,258,204,29,28,448,448
Heart_W,Heart_W_img_1.jpg,196,93,29,30,448,448
Heart_W,Heart_W_img_2.jpg,251,21,41,40,448,448
Heart_W,Heart_W_img_3.jpg,262,159,40,41,448,448
Heart_W,Heart_W_img_4.jpg,143,276,41,42,448,448
Binary file added Dataset/Heart_W/images/Heart_W_img_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_W/images/Heart_W_img_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_W/images/Heart_W_img_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_W/images/Heart_W_img_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dataset/Heart_W/images/Heart_W_img_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions Dataset_Tools/augment_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import numpy as np
import imgaug as ia
import imgaug.augmenters as iaa


def create_augmenter():
sometimes = lambda aug: iaa.Sometimes(0.5, aug)
seq = iaa.Sequential(
[
# execute 0 to 5 of the following (less important) augmenters per image
# don't execute all of them, as that would often be way too strong
iaa.SomeOf((0, 3),
[
sometimes(iaa.Superpixels(p_replace=(0, 1.0), n_segments=(20, 200))), # convert images into their superpixel representation
iaa.OneOf([
iaa.GaussianBlur((0, 3.0)), # blur images with a sigma between 0 and 3.0
iaa.AverageBlur(k=(2, 7)), # blur image using local means with kernel sizes between 2 and 7
iaa.MedianBlur(k=(3, 11)), # blur image using local medians with kernel sizes between 2 and 7
]),
iaa.Sharpen(alpha=(0, 1.0), lightness=(0.75, 1.5)), # sharpen images
iaa.Emboss(alpha=(0, 1.0), strength=(0, 2.0)), # emboss images
# search either for all edges or for directed edges,
# blend the result with the original image using a blobby mask
iaa.SimplexNoiseAlpha(iaa.OneOf([
iaa.EdgeDetect(alpha=(0.5, 1.0)),
iaa.DirectedEdgeDetect(alpha=(0.5, 1.0), direction=(0.0, 1.0)),
])),
iaa.AdditiveGaussianNoise(loc=0, scale=(0.0, 0.05*255), per_channel=0.5), # add gaussian noise to images
iaa.OneOf([
iaa.Dropout((0.01, 0.1), per_channel=0.5), # randomly remove up to 10% of the pixels
iaa.CoarseDropout((0.03, 0.15), size_percent=(0.02, 0.05), per_channel=0.2),
]),
iaa.Invert(0.05, per_channel=True), # invert color channels
iaa.Add((-10, 10), per_channel=0.5), # change brightness of images (by -10 to 10 of original value)
iaa.AddToHueAndSaturation((-20, 20)), # change hue and saturation
# either change the brightness of the whole image (sometimes
# per channel) or change the brightness of subareas
iaa.OneOf([
iaa.Multiply((0.5, 1.5), per_channel=0.5),
iaa.FrequencyNoiseAlpha(
exponent=(-4, 0),
first=iaa.Multiply((0.5, 1.5), per_channel=True),
second=iaa.LinearContrast((0.5, 2.0))
)
]),
iaa.LinearContrast((0.5, 2.0), per_channel=0.5), # improve or worsen the contrast
iaa.Grayscale(alpha=(0.0, 1.0)),
sometimes(iaa.ElasticTransformation(alpha=(0.5, 3.5), sigma=0.25)), # move pixels locally around (with random strengths)
sometimes(iaa.PiecewiseAffine(scale=(0.01, 0.05))), # sometimes move parts of the image around
sometimes(iaa.PerspectiveTransform(scale=(0.01, 0.1)))
],
random_order=True
)
],
random_order=True
)
return seq

def augment_images(images:list):
'''augment images in training set only'''
augmenter = create_augmenter()
return augmenter(images=images)
Loading