Skip to content

Commit

Permalink
type: fix
Browse files Browse the repository at this point in the history
description:
  - removed python-interface module because it is not working anymore in python3.7+
  - moved the cars_dataset to another repository
  - added a setup.py that produces an installable wheel for pip
  • Loading branch information
lozuwa committed Feb 13, 2019
1 parent f2e7bb6 commit eb7fa43
Show file tree
Hide file tree
Showing 30 changed files with 144 additions and 219 deletions.
46 changes: 0 additions & 46 deletions __init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion AnnotationProcessing.py → impy/AnnotationProcessing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Author: Rodrigo Loza
Email: [email protected]
Description: A class that performs processing operations with image annotations.
Description: A class that performs processing operations for image annotations.
"""
# General purpose
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,3 @@ def test_nms(self):

if __name__ == "__main__":
unittest.main()

# from impy.ImageLocalizationDataset import *
# imda = ImageLocalizationDataset(imagesDirectory = os.path.join(os.getcwd(), "images"),
# annotationsDirectory = os.path.join(os.getcwd(), "annotations"),
# databaseName = "SPID")
# imda.computeBoundingBoxStats()
18 changes: 3 additions & 15 deletions ApplyAugmentation.py → impy/ApplyAugmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,9 @@
"""

import numpy as np

try:
from .BoundingBoxAugmenters import *
except:
from BoundingBoxAugmenters import *

try:
from .ColorAugmenters import *
except:
from ColorAugmenters import *

try:
from .GeometricAugmenters import *
except:
from GeometricAugmenters import *
from BoundingBoxAugmenters import *
from ColorAugmenters import *
from GeometricAugmenters import *

bndboxAugmenter = BoundingBoxAugmenters()
colorAugmenter = ColorAugmenters()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import json
import numpy as np
from interface import implements
# from interface import implements

class AugmentationConfigurationFile(object):
def __init__(self, file = None):
Expand Down
27 changes: 7 additions & 20 deletions BoundingBoxAugmenters.py → impy/BoundingBoxAugmenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,20 @@
Sets pixels to zero with probability P.
"""
# Libraries
from interface import implements
# from interface import implements
import math
import random
import cv2
import numpy as np
# Other libraries
try:
from .ImagePreprocess import *
except:
from ImagePreprocess import *
from ImagePreprocess import *
# Interface
try:
from .BoundingBoxAugmentersMethods import *
except:
from BoundingBoxAugmentersMethods import *
from BoundingBoxAugmentersMethods import *
from GeometricAugmenters import *
from AssertDataTypes import *

try:
from .GeometricAugmenters import *
except:
from GeometricAugmenters import *

try:
from .AssertDataTypes import *
except:
from AssertDataTypes import *

class BoundingBoxAugmenters(implements(BoundingBoxAugmentersMethods)):
# class BoundingBoxAugmenters(implements(BoundingBoxAugmentersMethods)):
class BoundingBoxAugmenters(object):
"""
BoundingBoxAugmenters class. This class implements a set of data augmentation
tools for bouding boxes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
labels.
"""
# Libraries
from interface import Interface
# from interface import Interface

class BoundingBoxAugmentersMethods(Interface):
# class BoundingBoxAugmentersMethods(Interface):
class BoundingBoxAugmentersMethods(object):

def scale(self, frame = None, boundingBoxes = None, size = None, zoom = None, interpolationMethod = None):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import numpy as np
import cv2
from BoundingBoxAugmenters import *
from ImageAnnotation import *
from ImageAnnotation import *
from VectorOperations import *

class BoundingBoxAugmenters_test(unittest.TestCase):

def setUp(self):
img_path = os.path.join(os.getcwd(), "tests/cars_dataset/images/cars0.png")
annotation_path = os.path.join(os.getcwd(), "tests/cars_dataset/annotations/xmls/cars0.xml")
img_path = os.path.join(os.getcwd(), "../../cars_dataset/images/cars0.png")
annotation_path = os.path.join(os.getcwd(), "../../cars_dataset/annotations/xmls/cars0.xml")
assert os.path.isfile(img_path)
assert os.path.isfile(annotation_path)
# Image.
Expand All @@ -30,7 +30,7 @@ def setUp(self):
self.augmenter = BoundingBoxAugmenters()
# Testing options.
self.visualize = True
self.waitTime = 1000
self.waitTime = 100
self.windowSize = (800, 800)

def tearDown(self):
Expand Down
22 changes: 6 additions & 16 deletions ColorAugmenters.py → impy/ColorAugmenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,18 @@
of color's space PCA.
"""
# Libraries
from interface import implements
# from interface import implements
import math
import random
import cv2
import numpy as np

try:
from .ColorAugmentersMethods import *
except:
from ColorAugmentersMethods import *
from ColorAugmentersMethods import *
from VectorOperations import *
from AssertDataTypes import *

try:
from .VectorOperations import *
except:
from VectorOperations import *

try:
from .AssertDataTypes import *
except:
from AssertDataTypes import *

class ColorAugmenters(implements(ColorAugmentersMethods)):
# class ColorAugmenters(implements(ColorAugmentersMethods)):
class ColorAugmenters(object):
"""
ImageAugmenters class. This class implements a set of data augmentation
tools for bouding boxes.
Expand Down
5 changes: 3 additions & 2 deletions ColorAugmentersMethods.py → impy/ColorAugmentersMethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Author: Rodrigo Loza
Description: Common data augmentation methods for images.
"""
from interface import Interface
# from interface import Interface

class ColorAugmentersMethods(Interface):
# class ColorAugmentersMethods(Interface):
class ColorAugmentersMethods(object):

def invertColor(self, frame = None, CSpace = None):
"""
Expand Down
4 changes: 2 additions & 2 deletions ColorAugmenters_test.py → impy/ColorAugmenters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
class ColorAugmenters_test(unittest.TestCase):

def setUp(self):
img_path = os.path.join(os.getcwd(), "tests/cars_dataset/images/cars0.png")
img_path = os.path.join(os.getcwd(), "../../cars_dataset/images/cars0.png")
assert os.path.isfile(img_path)
# Image
self.frame = cv2.imread(img_path)
# Augmenters
self.augmenter = ColorAugmenters()
# Testing options
self.visualize = True
self.waitTime = 500
self.waitTime = 50
self.windowSize = (800, 800)

def tearDown(self):
Expand Down
22 changes: 6 additions & 16 deletions GeometricAugmenters.py → impy/GeometricAugmenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,18 @@
Randomly rotates the bounding boxes.
"""
# Libraries
from interface import implements
# from interface import implements
import math
import random
import cv2
import numpy as np

try:
from .GeometricAugmentersMethods import *
except:
from GeometricAugmentersMethods import *
from GeometricAugmentersMethods import *
from VectorOperations import *
from AssertDataTypes import *

try:
from .VectorOperations import *
except:
from VectorOperations import *

try:
from .AssertDataTypes import *
except:
from AssertDataTypes import *

class GeometricAugmenters(implements(GeometricAugmentersMethods)):
# class GeometricAugmenters(implements(GeometricAugmentersMethods)):
class GeometricAugmenters(object):
"""
GeometricAugmenters class. This class implements a set of data augmentation
tools for bouding boxes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Author: Rodrigo Loza
Description: Common data augmentation methods for images.
"""
from interface import Interface
# from interface import Interface

class GeometricAugmentersMethods(Interface):
# class GeometricAugmentersMethods(Interface):
class GeometricAugmentersMethods(object):

def scale(self, frame = None, size = None, interpolationMethod = None):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
class GeometricAugmenters_test(unittest.TestCase):

def setUp(self):
img_path = os.path.join(os.getcwd(), "tests/cars_dataset/images/cars0.png")
img_path = os.path.join(os.getcwd(), "../../cars_dataset/images/cars0.png")
assert os.path.isfile(img_path)
# Image.
self.frame = cv2.imread(img_path)
# Augmenters.
self.augmenter = GeometricAugmenters()
# Testing options.
self.visualize = True
self.waitTime = 2000
self.waitTime = 50
self.windowSize = (800, 800)

def tearDown(self):
Expand Down
File renamed without changes.
17 changes: 3 additions & 14 deletions ImageDataset.py → impy/ImageDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,9 @@
from interface import implements
from tqdm import tqdm

try:
from .AugmentationConfigurationFile import *
except:
from AugmentationConfigurationFile import *

try:
from .ApplyAugmentation import applyGeometricAugmentation, applyColorAugmentation
except:
from ApplyAugmentation import applyGeometricAugmentation, applyColorAugmentation

try:
from .Util import *
except:
from Util import *
from AugmentationConfigurationFile import *
from ApplyAugmentation import applyGeometricAugmentation, applyColorAugmentation
from Util import *

class ImageDataset(object):
def __init__(self, imagesDirectory = None, dbName = None):
Expand Down
8 changes: 4 additions & 4 deletions ImageDataset_test.py → impy/ImageDataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

class ImageDataset_test(unittest.TestCase):
def setUp(self):
self.imgs = os.path.join(os.getcwd(), "tests", "cars_dataset", "images")
self.imgs = os.path.join(os.getcwd(), "../", "../", "cars_dataset", "images")
self.imda = ImageDataset(imagesDirectory = self.imgs, \
dbName = "UnitTest")

def tearDown(self):
pass

def test_apply_data_augmentation(self):
os.system("rm {}/*".format(os.path.join(os.getcwd(), "tests", "cars_dataset", "images_single")))
conf_file = os.path.join(os.getcwd(), "confs_examples", \
os.system("rm {}/*".format(os.path.join(os.getcwd(), "../", "../", "cars_dataset", "images_single")))
conf_file = os.path.join(os.getcwd(), "../", "confs_examples", \
"aug_multiple_geometric_color_sequential.json")
self.imda.applyDataAugmentation(configurationFile = conf_file, \
outputImageDirectory = os.path.join(os.getcwd(), \
"tests", "cars_dataset", "images_single"))
"../", "../", "cars_dataset", "images_single"))

if __name__ == "__main__":
unittest.main()
7 changes: 0 additions & 7 deletions ImagePreprocess.py → impy/ImagePreprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
class: ImagePreprocess
Author: Rodrigo Loza
Description: Common pre-processing operations for images.
Log:
August, 2017 -> Created class and added most relevant functions.
September, 2017 -> Created more features for the DivideIntoPatches method.
November, 2017 -> Refactored all the code to Google style and a more OOP paradigm approach.
December, 2017 -> Tested refactor to avoid breaking external code.
March, 2018 -> Refactored methods.
April, 2018 -> AdjustImage method added to class.
"""
# Utils
import numpy as np
Expand Down
File renamed without changes.
Loading

0 comments on commit eb7fa43

Please sign in to comment.