From 5ca68dbcbc298ccb3490b840e241098c846bb7b4 Mon Sep 17 00:00:00 2001 From: Jan Ivanecky Date: Tue, 29 Nov 2016 19:56:37 +0100 Subject: [PATCH] Added dataset processing files --- dataset/README.txt | 36 ++ dataset/test/_solarized.py | 43 ++ dataset/test/_structure_classes.py | 974 +++++++++++++++++++++++++++++ dataset/test/convert.py | 182 ++++++ dataset/test/create_test_lmdb.sh | 29 + dataset/test/crop.py | 60 ++ dataset/test/process_test.sh | 13 + dataset/train/create_train_lmdb.sh | 88 +++ dataset/train/get_train_scenes.m | 19 + dataset/train/process_raw.m | 57 ++ dataset/train/split_train_set.sh | 21 + dataset/train/train_augment0.py | 48 ++ dataset/train/train_augment1.py | 108 ++++ dataset/train/train_augment2.py | 109 ++++ 14 files changed, 1787 insertions(+) create mode 100644 dataset/README.txt create mode 100644 dataset/test/_solarized.py create mode 100644 dataset/test/_structure_classes.py create mode 100644 dataset/test/convert.py create mode 100755 dataset/test/create_test_lmdb.sh create mode 100644 dataset/test/crop.py create mode 100755 dataset/test/process_test.sh create mode 100755 dataset/train/create_train_lmdb.sh create mode 100644 dataset/train/get_train_scenes.m create mode 100644 dataset/train/process_raw.m create mode 100755 dataset/train/split_train_set.sh create mode 100644 dataset/train/train_augment0.py create mode 100644 dataset/train/train_augment1.py create mode 100644 dataset/train/train_augment2.py diff --git a/dataset/README.txt b/dataset/README.txt new file mode 100644 index 0000000..a640e86 --- /dev/null +++ b/dataset/README.txt @@ -0,0 +1,36 @@ +=================================================== +Required libraries for python2.7: +=================================================== +- caffe, h5py, scipy, scikit-image, numpy, pypng and joblib. + + +=================================================== +How to process the training dataset: +=================================================== +1.) Download RAW NYU Depth v2. dataset (450GB) from http://horatio.cs.nyu.edu/mit/silberman/nyu_depth_v2/nyu_depth_v2_raw.zip +2.) Extract the RAW dataset into a folder A (name not important) +3.) Download NYU Depth v2. toolbox from http://cs.nyu.edu/~silberman/code/toolbox_nyu_depth_v2.zip +4.) Extract scripts from the toolbox to folder 'tools' in folder A +5.) Run process_raw.m in folder A +6.) Download labeled NYU Depth v2. dataset from http://horatio.cs.nyu.edu/mit/silberman/nyu_depth_v2/nyu_depth_v2_labeled.mat +7.) Download splits.mat containing official train/test split http://horatio.cs.nyu.edu/mit/silberman/indoor_seg_sup/splits.mat +8.) Make sure that labeled dataset and splits.mat are in the same folder, let's call it folder B +9.) Run get_train_scenes.m in the folder B +10.) Run split_train_set.sh in the folder B and pass it a single argument, path to folder A ('......./path/to/folder/A') +11.) Run scripts train_augment0.py, train_augment1.py, train_augment2.py in folder B +11.) Run create_train_lmdb.sh in folder B and pass it a path to caffe folder as an argument +12.) You should now have folders 'train_raw0_lmdb' (dataset version Data0), 'train_raw1_lmdb' (dataset version Data1), 'train_raw2_lmdb' (dataset version Data2) in folder B +*Note: all referenced scripts can be foun in folder 'train' + +=================================================== +How to process the testing dataset: +=================================================== + +1.) Download labeled NYU Depth v2. dataset from http://horatio.cs.nyu.edu/mit/silberman/nyu_depth_v2/nyu_depth_v2_labeled.mat +2.) Download splits.mat containing official train/test split http://horatio.cs.nyu.edu/mit/silberman/indoor_seg_sup/splits.mat +3.) Place all downloaded files into single folder +4.) Run script process_test.sh +5.) Run create_test_lmdb.sh and pass it a path to caffe folder as an argument +6.) You should now have a folder 'test_lmdb' in your working directory +*Note: all referenced scripts can be found in folder 'test' +*Note2: files crop.py, _structure_classes.py, _solarized.py come from https://github.com/deeplearningais/curfil/wiki/Training-and-Prediction-with-the-NYU-Depth-v2-Dataset diff --git a/dataset/test/_solarized.py b/dataset/test/_solarized.py new file mode 100644 index 0000000..9d64316 --- /dev/null +++ b/dataset/test/_solarized.py @@ -0,0 +1,43 @@ +####################################################################################### +# The MIT License + +# Copyright (c) 2014 Hannes Schulz, University of Bonn +# Copyright (c) 2013 Benedikt Waldvogel, University of Bonn +# Copyright (c) 2008-2009 Sebastian Nowozin + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +####################################################################################### +colors = [ + (0, 43, 54), + (7, 54, 66), # floor + (88, 110, 117), + (101, 123, 131), + (131, 148, 150), + (147, 161, 161), # structure + (238, 232, 213), + (253, 246, 227), + (181, 137, 0), # prop + (203, 75, 22), # furniture + (220, 50, 47), + (211, 54, 130), + (108, 113, 196), + (38, 139, 210), + (42, 161, 152), + (133, 153, 0) +] diff --git a/dataset/test/_structure_classes.py b/dataset/test/_structure_classes.py new file mode 100644 index 0000000..a4c9f59 --- /dev/null +++ b/dataset/test/_structure_classes.py @@ -0,0 +1,974 @@ +####################################################################################### +# The MIT License + +# Copyright (c) 2014 Hannes Schulz, University of Bonn +# Copyright (c) 2013 Benedikt Waldvogel, University of Bonn +# Copyright (c) 2008-2009 Sebastian Nowozin + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +####################################################################################### +def get_structure_classes(): + structure_classes = dict() + structure_classes['shutters'] = "structure" + structure_classes['shelving'] = "furniture"; + structure_classes['leg of table'] = "furniture"; + structure_classes['colunn'] = "structure" + structure_classes['scissors'] = "prop"; + structure_classes['plate with bottles'] = "prop"; + structure_classes['plastic container'] = "prop"; + structure_classes['hanging items'] = "prop"; + structure_classes['leather sitting stool'] = "furniture"; + structure_classes['colors'] = "prop"; + structure_classes['trible bed sofa'] = "furniture"; + structure_classes['hanging board'] = "structure" + structure_classes['wall frame'] = "prop"; + structure_classes['brief case'] = "prop"; + structure_classes['leg of chair'] = "furniture"; + structure_classes['notice board'] = "structure" + structure_classes['bathroom clearning brush'] = "prop"; + structure_classes['chess set'] = "prop"; + structure_classes['brush'] = "prop"; + structure_classes['cabint'] = "furniture"; + structure_classes['noticeboard'] = "structure" + structure_classes['headboard'] = "furniture"; + structure_classes['coffee table'] = "furniture"; + structure_classes['measuring cup'] = "prop"; + structure_classes['bottle of ketchup'] = "prop"; + structure_classes['reflection of window shutters'] = "structure" + structure_classes['air conditioner'] = "structure" + structure_classes['air duct'] = "structure" + structure_classes['air vent'] = "structure" + structure_classes['alarm clock'] = "prop"; + structure_classes['album'] = "prop"; + structure_classes['aluminium foil'] = "prop"; + structure_classes['antenna'] = "prop"; + structure_classes['apple'] = "prop"; + structure_classes['ashtray'] = "prop"; + structure_classes['avocado'] = "prop"; + structure_classes['baby chair'] = "furniture"; + structure_classes['baby gate'] = "structure" + structure_classes['back scrubber'] = "prop"; + structure_classes['backpack'] = "prop"; + structure_classes['bag'] = "prop"; + structure_classes['bag of bagels'] = "prop"; + structure_classes['bag of chips'] = "prop"; + structure_classes['bag of flour'] = "prop"; + structure_classes['bag of hot dog buns'] = "prop"; + structure_classes['bag of oreo'] = "prop"; + structure_classes['bagel'] = "prop"; + structure_classes['baking dish'] = "prop"; + structure_classes['ball'] = "prop"; + structure_classes['balloon'] = "prop"; + structure_classes['banana'] = "prop"; + structure_classes['banister'] = "structure" + structure_classes['bar'] = "structure" + structure_classes['bar of soap'] = "prop"; + structure_classes['barrel'] = "furniture"; + structure_classes['baseball'] = "prop"; + structure_classes['basket'] = "prop"; + structure_classes['basketball'] = "prop"; + structure_classes['basketball hoop'] = "prop"; + structure_classes['bassinet'] = "furniture"; + structure_classes['bathtub'] = "furniture"; + structure_classes['bean bag'] = "furniture"; + structure_classes['bed'] = "furniture"; + structure_classes['bedding package'] = "prop"; + structure_classes['beeper'] = "prop"; + structure_classes['belt'] = "prop"; + structure_classes['bench'] = "furniture"; + structure_classes['bicycle'] = "prop"; + structure_classes['bicycle helmet'] = "prop"; + structure_classes['bin'] = "prop"; + structure_classes['binder'] = "prop"; + structure_classes['blackboard'] = "structure" + structure_classes['blanket'] = "prop"; + structure_classes['blender'] = "prop"; + structure_classes['blinds'] = "structure" + structure_classes['board'] = "structure" + structure_classes['book'] = "prop"; + structure_classes['bookend'] = "prop"; + structure_classes['bookrack'] = "furniture"; + structure_classes['books'] = "prop"; + structure_classes['bookshelf'] = "furniture"; + structure_classes['bottle'] = "prop"; + structure_classes['bottle of comet'] = "prop"; + structure_classes['bottle of contact lens solution'] = "prop"; + structure_classes['bottle of liquid'] = "prop"; + structure_classes['bottle of perfume'] = "prop"; + structure_classes['bowl'] = "prop"; + structure_classes['box'] = "prop"; + structure_classes['box of ziplock bags'] = "prop"; + structure_classes['bread'] = "prop"; + structure_classes['bread pan'] = "prop"; + structure_classes['brick'] = "prop"; + structure_classes['briefcase'] = "prop"; + structure_classes['broom'] = "prop"; + structure_classes['bucket'] = "prop"; + structure_classes['bulb'] = "prop"; + structure_classes['bunk bed'] = "furniture"; + structure_classes['business cards'] = "prop"; + structure_classes['butterfly sculpture'] = "prop"; + structure_classes['cabinet'] = "furniture"; + structure_classes['cable box'] = "prop"; + structure_classes['cable modem'] = "prop"; + structure_classes['cable rack'] = "structure" + structure_classes['cables'] = "prop"; + structure_classes['cactus'] = "prop"; + structure_classes['cake'] = "prop"; + structure_classes['calculator'] = "prop"; + structure_classes['calendar'] = "prop"; + structure_classes['camera'] = "prop"; + structure_classes['can'] = "prop"; + structure_classes['can of food'] = "prop"; + structure_classes['can opener'] = "prop"; + structure_classes['candelabra'] = "prop"; + structure_classes['candle'] = "prop"; + structure_classes['candlestick'] = "prop"; + structure_classes['cane'] = "prop"; + structure_classes['canister'] = "prop"; + structure_classes['cans of cat food'] = "prop"; + structure_classes['cap stand'] = "prop"; + structure_classes['car'] = "prop"; + structure_classes['cart'] = "prop"; + structure_classes['carton'] = "prop"; + structure_classes['case'] = "prop"; + structure_classes['casserole dish'] = "prop"; + structure_classes['cat'] = "prop"; + structure_classes['cat bed'] = "furniture"; + structure_classes['cat cage'] = "furniture"; + structure_classes['cd'] = "prop"; + structure_classes['cd disc'] = "prop"; + structure_classes['cd player'] = "prop"; + structure_classes['ceiling'] = "structure" + structure_classes['celery'] = "prop"; + structure_classes['cell phone'] = "prop"; + structure_classes['cell phone charger'] = "prop"; + structure_classes['centerpiece'] = "prop"; + structure_classes['ceramic frog'] = "prop"; + structure_classes['certificate'] = "prop"; + structure_classes['chair'] = "furniture"; + structure_classes['chalk eraser'] = "prop"; + structure_classes['chalkboard'] = "prop"; + structure_classes['chandelier'] = "structure" + structure_classes['chapstick'] = "prop"; + structure_classes['charger'] = "prop"; + structure_classes['charger and wire'] = "prop"; + structure_classes['chart'] = "prop"; + structure_classes['chart roll'] = "prop"; + structure_classes['chart stand'] = "furniture"; + structure_classes['charts'] = "prop"; + structure_classes['chessboard'] = "prop"; + structure_classes['chest'] = "furniture"; + structure_classes['child carrier'] = "prop"; + structure_classes['chimney'] = "structure" + structure_classes['circuit breaker box'] = "structure" + structure_classes['classroom board'] = "structure" + structure_classes['cleaner'] = "prop"; + structure_classes['cleaning wipes'] = "prop"; + structure_classes['clipboard'] = "prop"; + structure_classes['clock'] = "prop"; + structure_classes['cloth bag'] = "prop"; + structure_classes['cloth drying stand'] = "furniture"; + structure_classes['clothes'] = "prop"; + structure_classes['clothing detergent'] = "prop"; + structure_classes['clothing dryer'] = "furniture"; + structure_classes['clothing drying rack'] = "furniture"; + structure_classes['clothing hamper'] = "furniture"; + structure_classes['clothing hanger'] = "furniture"; + structure_classes['clothing iron'] = "prop"; + structure_classes['clothing washer'] = "furniture"; + structure_classes['coaster'] = "prop"; + structure_classes['coffee bag'] = "prop"; + structure_classes['coffee grinder'] = "prop"; + structure_classes['coffee machine'] = "prop"; + structure_classes['coffee packet'] = "prop"; + structure_classes['coffee pot'] = "prop"; + structure_classes['coins'] = "prop"; + structure_classes['coke bottle'] = "prop"; + structure_classes['collander'] = "prop"; + structure_classes['cologne'] = "prop"; + structure_classes['column'] = "structure" + structure_classes['comb'] = "prop"; + structure_classes['comforter'] = "prop"; + structure_classes['computer'] = "prop"; + structure_classes['computer disk'] = "prop"; + structure_classes['conch shell'] = "prop"; + structure_classes['cone'] = "prop"; + structure_classes['console controller'] = "prop"; + structure_classes['console system'] = "prop"; + structure_classes['contact lens case'] = "prop"; + structure_classes['contact lens solution bottle'] = "prop"; + structure_classes['container'] = "prop"; + structure_classes['container of skin cream'] = "prop"; + structure_classes['cooking pan'] = "prop"; + structure_classes['cooking pot cover'] = "prop"; + structure_classes['copper vessel'] = "prop"; + structure_classes['cordless phone'] = "prop"; + structure_classes['cordless telephone'] = "prop"; + structure_classes['cork board'] = "prop"; + structure_classes['corkscrew'] = "prop"; + structure_classes['corn'] = "prop"; + structure_classes['counter'] = "structure" + structure_classes['cradle'] = "furniture"; + structure_classes['crate'] = "furniture"; + structure_classes['crayon'] = "prop"; + structure_classes['cream'] = "prop"; + structure_classes['cream tube'] = "prop"; + structure_classes['crib'] = "furniture"; + structure_classes['crock pot'] = "prop"; + structure_classes['cup'] = "prop"; + structure_classes['curtain'] = "structure" + structure_classes['curtain rod'] = "structure" + structure_classes['cutting board'] = "prop"; + structure_classes['cylindrical paper holder'] = "prop"; + structure_classes['decanter'] = "prop"; + structure_classes['decoration item'] = "prop"; + structure_classes['decorative bottle'] = "prop"; + structure_classes['decorative dish'] = "prop"; + structure_classes['decorative item'] = "prop"; + structure_classes['decorative plate'] = "prop"; + structure_classes['decorative platter'] = "prop"; + structure_classes['deodarent spray bottle'] = "prop"; + structure_classes['deoderant'] = "prop"; + structure_classes['desk'] = "furniture"; + structure_classes['desk drawer'] = "furniture"; + structure_classes['desk mat'] = "prop"; + structure_classes['desser'] = "furniture"; + structure_classes['dish'] = "prop"; + structure_classes['dish brush'] = "prop"; + structure_classes['dish cover'] = "prop"; + structure_classes['dish rack'] = "prop"; + structure_classes['dish scrubber'] = "prop"; + structure_classes['dishes'] = "prop"; + structure_classes['dishwasher'] = "structure" + structure_classes['display board'] = "furniture"; + structure_classes['display case'] = "furniture"; + structure_classes['display platter'] = "prop"; + structure_classes['dog'] = "prop"; + structure_classes['dog bed'] = "furniture"; + structure_classes['dog bowl'] = "prop"; + structure_classes['dog cage'] = "furniture"; + structure_classes['dog toy'] = "prop"; + structure_classes['doily'] = "furniture"; + structure_classes['doll'] = "prop"; + structure_classes['doll house'] = "furniture"; + structure_classes['dollar bill'] = "prop"; + structure_classes['dolly'] = "furniture" + structure_classes['door'] = "structure" + structure_classes['door window reflection'] = "structure" + structure_classes['door curtain'] = "structure" + structure_classes['door facing trimreflection'] = "structure" + structure_classes['door frame'] = "structure" + structure_classes['door knob'] = "prop"; + structure_classes['door lock'] = "prop"; + structure_classes['door way'] = "structure" + structure_classes['door way arch'] = "structure" + structure_classes['doorreflection'] = "structure" + structure_classes['drain'] = "structure" + structure_classes['drawer'] = "furniture"; + structure_classes['drawer handle'] = "prop"; + structure_classes['dress wire frame'] = "prop"; + structure_classes['dresser'] = "furniture"; + structure_classes['drum'] = "prop"; + structure_classes['drying rack'] = "furniture"; + structure_classes['drying stand'] = "furniture"; + structure_classes['duck'] = "prop"; + structure_classes['duster'] = "prop"; + structure_classes['dvd'] = "prop"; + structure_classes['dvd player'] = "prop"; + structure_classes['dvds'] = "prop"; + structure_classes['earphone'] = "prop"; + structure_classes['earplugs'] = "prop"; + structure_classes['educational display'] = "furniture"; + structure_classes['eggplant'] = "prop"; + structure_classes['eggs'] = "prop"; + structure_classes['electric box'] = "structure" + structure_classes['electric mixer'] = "prop"; + structure_classes['electric toothbrush'] = "prop"; + structure_classes['electric toothbrush base'] = "prop"; + structure_classes['electrical kettle'] = "prop"; + structure_classes['electrical outlet'] = "prop"; + structure_classes['electrical plug'] = "prop"; + structure_classes['electronic drumset'] = "prop"; + structure_classes['envelope'] = "prop"; + structure_classes['envelopes'] = "prop"; + structure_classes['eraser'] = "prop"; + structure_classes['ethernet jack'] = "prop"; + structure_classes['excercise ball'] = "prop"; + structure_classes['excercise equipment'] = "furniture"; + structure_classes['excercise machine'] = "furniture"; + structure_classes['exit sign'] = "prop"; + structure_classes['eye glasses'] = "prop"; + structure_classes['eyeball plastic ball'] = "prop"; + structure_classes['face wash cream'] = "prop"; + structure_classes['fan'] = "prop"; + structure_classes['fashion medal'] = "prop"; + structure_classes['faucet'] = "prop"; + structure_classes['faucet handle'] = "prop"; + structure_classes['fax machine'] = "prop"; + structure_classes['fiberglass case'] = "prop"; + structure_classes['file'] = "prop"; + structure_classes['file box'] = "furniture"; + structure_classes['file container'] = "prop"; + structure_classes['file holder'] = "prop"; + structure_classes['file pad'] = "prop"; + structure_classes['file stand'] = "furniture"; + structure_classes['filing shelves'] = "furniture"; + structure_classes['fire alarm'] = "prop"; + structure_classes['fire extinguisher'] = "prop"; + structure_classes['fireplace'] = "structure" + structure_classes['fish tank'] = "structure" + structure_classes['flag'] = "prop"; + structure_classes['flashcard'] = "prop"; + structure_classes['flashlight'] = "prop"; + structure_classes['flask'] = "prop"; + structure_classes['flask set'] = "prop"; + structure_classes['flatbed scanner'] = "prop"; + structure_classes['flipboard'] = "furniture"; + structure_classes['floor'] = "floor"; + structure_classes['floor mat'] = "prop"; + structure_classes['flower'] = "prop"; + structure_classes['flower basket'] = "prop"; + structure_classes['flower box'] = "prop"; + structure_classes['flower pot'] = "prop"; + structure_classes['folder'] = "prop"; + structure_classes['folders'] = "prop"; + structure_classes['food processor'] = "prop"; + structure_classes['food wrapped on a tray'] = "prop"; + structure_classes['foosball table'] = "furniture"; + structure_classes['foot rest'] = "furniture"; + structure_classes['football'] = "prop"; + structure_classes['fork'] = "prop"; + structure_classes['framed certificate'] = "prop"; + structure_classes['fruit'] = "prop"; + structure_classes['fruit basket'] = "prop"; + structure_classes['fruit platter'] = "prop"; + structure_classes['fruit stand'] = "prop"; + structure_classes['fruitplate'] = "prop"; + structure_classes['frying pan'] = "prop"; + structure_classes['furnace'] = "furniture"; + structure_classes['furniture'] = "furniture"; + structure_classes['game system'] = "prop"; + structure_classes['game table'] = "prop"; + structure_classes['garage door'] = "structure" + structure_classes['garbage bag'] = "prop"; + structure_classes['garbage bin'] = "furniture"; + structure_classes['garlic'] = "prop"; + structure_classes['gate'] = "structure" + structure_classes['gift wrapping'] = "prop"; + structure_classes['gift wrapping roll'] = "prop"; + structure_classes['glass'] = "structure" + structure_classes['glass baking dish'] = "prop"; + structure_classes['glass box'] = "prop"; + structure_classes['glass container'] = "prop"; + structure_classes['glass dish'] = "prop"; + structure_classes['glass pane'] = "structure" + structure_classes['glass pot'] = "prop"; + structure_classes['glass rack'] = "structure" + structure_classes['glass set'] = "prop"; + structure_classes['glass ware'] = "prop"; + structure_classes['globe'] = "prop"; + structure_classes['globe stand'] = "prop"; + structure_classes['glove'] = "prop"; + structure_classes['gold piece'] = "prop"; + structure_classes['grandfather clock'] = "furniture"; + structure_classes['grapefruit'] = "prop"; + structure_classes['green screen'] = "structure" + structure_classes['grill'] = "structure" + structure_classes['guitar'] = "prop"; + structure_classes['guitar case'] = "prop"; + structure_classes['hair brush'] = "prop"; + structure_classes['hair dryer'] = "prop"; + structure_classes['hamburger bun'] = "prop"; + structure_classes['hammer'] = "prop"; + structure_classes['hand blender'] = "prop"; + structure_classes['hand sanitizer'] = "prop"; + structure_classes['hand sanitizer dispenser'] = "prop"; + structure_classes['hand sculpture'] = "prop"; + structure_classes['hanger'] = "prop"; + structure_classes['hangers'] = "prop"; + structure_classes['hanging hooks'] = "prop"; + structure_classes['hat'] = "prop"; + structure_classes['head phone'] = "prop"; + structure_classes['head phones'] = "prop"; + structure_classes['headband'] = "prop"; + structure_classes['headphones'] = "prop"; + structure_classes['heater'] = "furniture"; + structure_classes['hockey glove'] = "prop"; + structure_classes['hockey stick'] = "prop"; + structure_classes['hole puncher'] = "prop"; + structure_classes['hookah'] = "prop"; + structure_classes['hooks'] = "prop"; + structure_classes['hoola hoop'] = "prop"; + structure_classes['horse toy'] = "prop"; + structure_classes['hot dogs'] = "prop"; + structure_classes['hot water heater'] = "prop"; + structure_classes['humidifier'] = "prop"; + structure_classes['id card'] = "prop"; + structure_classes['incense candle'] = "prop"; + structure_classes['incense holder'] = "prop"; + structure_classes['inkwell'] = "prop"; + structure_classes['ipad'] = "prop"; + structure_classes['ipod'] = "prop"; + structure_classes['ipod dock'] = "prop"; + structure_classes['iron box'] = "prop"; + structure_classes['iron grill'] = "structure" + structure_classes['ironing board'] = "furniture"; + structure_classes['jacket'] = "prop"; + structure_classes['jar'] = "prop"; + structure_classes['jersey'] = "prop"; + structure_classes['jug'] = "prop"; + structure_classes['juicer'] = "prop"; + structure_classes['karate belts'] = "prop"; + structure_classes['key'] = "prop"; + structure_classes['keyboard'] = "prop"; + structure_classes['kichen towel'] = "prop"; + structure_classes['kinect'] = "prop"; + structure_classes['kitchen container plastic'] = "prop"; + structure_classes['kitchen island'] = "structure" + structure_classes['kitchen items'] = "prop"; + structure_classes['kitchen utensil'] = "prop"; + structure_classes['kitchen utensils'] = "prop"; + structure_classes['kiwi'] = "prop"; + structure_classes['knife'] = "prop"; + structure_classes['knife rack'] = "prop"; + structure_classes['knob'] = "prop"; + structure_classes['knobs'] = "prop"; + structure_classes['label'] = "prop"; + structure_classes['ladder'] = "furniture"; + structure_classes['ladel'] = "prop"; + structure_classes['lamp'] = "prop"; + structure_classes['laptop'] = "prop"; + structure_classes['laundry basket'] = "prop"; + structure_classes['laundry detergent jug'] = "prop"; + structure_classes['lazy susan'] = "prop"; + structure_classes['leather sofa'] = "furniture"; + structure_classes['lectern'] = "furniture"; + structure_classes['leg of a girl'] = "prop"; + structure_classes['lego'] = "prop"; + structure_classes['letter stand'] = "prop"; + structure_classes['letters'] = "prop"; + structure_classes['lid'] = "prop"; + structure_classes['lid of jar'] = "prop"; + structure_classes['life jacket'] = "prop"; + structure_classes['light'] = "structure" + structure_classes['light bulb'] = "prop"; + structure_classes['light switch'] = "structure" + structure_classes['light switchreflection'] = "structure" + structure_classes['lighting track'] = "structure" + structure_classes['lint comb'] = "prop"; + structure_classes['lint roller'] = "prop"; + structure_classes['litter box'] = "prop"; + structure_classes['luggage'] = "prop"; + structure_classes['luggage rack'] = "furniture"; + structure_classes['lunch bag'] = "prop"; + structure_classes['machine'] = "prop"; + structure_classes['magazine'] = "prop"; + structure_classes['magazine holder'] = "prop"; + structure_classes['magic 8ball'] = "prop"; + structure_classes['magnet'] = "prop"; + structure_classes['mail shelf'] = "structure" + structure_classes['mailshelf'] = "structure" + structure_classes['mail tray'] = "prop"; + structure_classes['makeup brush'] = "prop"; + structure_classes['manilla envelope'] = "prop"; + structure_classes['mantel'] = "structure" + structure_classes['map'] = "prop"; + structure_classes['mask'] = "prop"; + structure_classes['matchbox'] = "prop"; + structure_classes['mattress'] = "furniture"; + structure_classes['medal'] = "prop"; + structure_classes['medicine tube'] = "prop"; + structure_classes['mellon'] = "prop"; + structure_classes['menorah'] = "prop"; + structure_classes['mens suit'] = "prop"; + structure_classes['mens tie'] = "prop"; + structure_classes['mezuza'] = "prop"; + structure_classes['microphone'] = "prop"; + structure_classes['microphone stand'] = "prop"; + structure_classes['microwave'] = "prop"; + structure_classes['mirror'] = "prop"; + structure_classes['model boat'] = "prop"; + structure_classes['modem'] = "prop"; + structure_classes['money'] = "prop"; + structure_classes['monitor'] = "prop"; + structure_classes['motion camera'] = "prop"; + structure_classes['mouse'] = "prop"; + structure_classes['mouse pad'] = "prop"; + structure_classes['muffins'] = "prop"; + structure_classes['mug hanger'] = "prop"; + structure_classes['mug holder'] = "prop"; + structure_classes['music keyboard'] = "prop"; + structure_classes['music stand'] = "furniture"; + structure_classes['music stereo'] = "prop"; + structure_classes['nailclipper'] = "prop"; + structure_classes['napkin'] = "prop"; + structure_classes['napkin dispenser'] = "prop"; + structure_classes['napkin holder'] = "prop"; + structure_classes['necklace'] = "prop"; + structure_classes['necklace holder'] = "prop"; + structure_classes['night stand'] = "furniture"; + structure_classes['notebook'] = "prop"; + structure_classes['notecards'] = "prop"; + structure_classes['oil container'] = "prop"; + structure_classes['onion'] = "prop"; + structure_classes['orange'] = "prop"; + structure_classes['orange juicer'] = "prop"; + structure_classes['orange plastic cap'] = "prop"; + structure_classes['ornamental item'] = "prop"; + structure_classes['ornamental plant'] = "prop"; + structure_classes['ornamental pot'] = "prop"; + structure_classes['ottoman'] = "furniture"; + structure_classes['oven'] = "structure" + structure_classes['oven handle'] = "prop"; + structure_classes['oven mitt'] = "prop"; + structure_classes['package of bedroom sheets'] = "prop"; + structure_classes['package of bottled water'] = "prop"; + structure_classes['package of water'] = "prop"; + structure_classes['pan'] = "prop"; + structure_classes['paper'] = "prop"; + structure_classes['paper bundle'] = "prop"; + structure_classes['paper cutter'] = "prop"; + structure_classes['paper holder'] = "prop"; + structure_classes['paper rack'] = "prop"; + structure_classes['paper towel'] = "prop"; + structure_classes['paper towel dispenser'] = "prop"; + structure_classes['paper towel holder'] = "prop"; + structure_classes['paper tray'] = "prop"; + structure_classes['paper weight'] = "prop"; + structure_classes['papers'] = "prop"; + structure_classes['peach'] = "prop"; + structure_classes['pen'] = "prop"; + structure_classes['pen box'] = "prop"; + structure_classes['pen cup'] = "prop"; + structure_classes['pen holder'] = "prop"; + structure_classes['pen stand'] = "prop"; + structure_classes['pencil'] = "prop"; + structure_classes['pencil holder'] = "prop"; + structure_classes['pencils pens'] = "prop"; + structure_classes['penholder'] = "prop"; + structure_classes['pepper'] = "prop"; + structure_classes['pepper grinder'] = "prop"; + structure_classes['pepper shaker'] = "prop"; + structure_classes['perfume'] = "prop"; + structure_classes['perfume box'] = "prop"; + structure_classes['person'] = "prop"; + structure_classes['personal care liquid'] = "prop"; + structure_classes['phone jack'] = "structure" + structure_classes['photo'] = "prop"; + structure_classes['piano'] = "furniture"; + structure_classes['piano bench'] = "furniture"; + structure_classes['picture'] = "prop"; + structure_classes['picture of fish'] = "prop"; + structure_classes['piece of wood'] = "prop"; + structure_classes['pig'] = "prop"; + structure_classes['pillow'] = "prop"; + structure_classes['pineapple'] = "prop"; + structure_classes['ping pong racquet'] = "prop"; + structure_classes['ping pong table'] = "furniture"; + structure_classes['pipe'] = "prop"; + structure_classes['pitcher'] = "prop"; + structure_classes['pizza box'] = "prop"; + structure_classes['placard'] = "prop"; + structure_classes['placemat'] = "prop"; + structure_classes['plant'] = "prop"; + structure_classes['plant pot'] = "prop"; + structure_classes['plaque'] = "prop"; + structure_classes['plastic bowl'] = "prop"; + structure_classes['plastic box'] = "prop"; + structure_classes['plastic chair'] = "prop"; + structure_classes['plastic crate'] = "prop"; + structure_classes['plastic cup of coffee'] = "prop"; + structure_classes['plastic dish'] = "prop"; + structure_classes['plastic rack'] = "prop"; + structure_classes['plastic toy container'] = "prop"; + structure_classes['plastic tray'] = "prop"; + structure_classes['plastic tub'] = "prop"; + structure_classes['plate'] = "prop"; + structure_classes['platter'] = "prop"; + structure_classes['playpen'] = "furniture"; + structure_classes['pool sticks'] = "prop"; + structure_classes['pool table'] = "furniture"; + structure_classes['poster'] = "prop"; + structure_classes['poster board'] = "prop"; + structure_classes['poster case'] = "prop"; + structure_classes['pot'] = "prop"; + structure_classes['potato'] = "prop"; + structure_classes['power surge'] = "prop"; + structure_classes['printer'] = "prop"; + structure_classes['projector'] = "prop"; + structure_classes['projector screen'] = "structure" + structure_classes['pump dispenser'] = "prop"; + structure_classes['puppy toy'] = "prop"; + structure_classes['purse'] = "prop"; + structure_classes['quill'] = "prop"; + structure_classes['quilt'] = "prop"; + structure_classes['radiator'] = "furniture"; + structure_classes['radio'] = "prop"; + structure_classes['rags'] = "prop"; + structure_classes['railing'] = "structure" + structure_classes['range hood'] = "structure" + structure_classes['razor'] = "prop"; + structure_classes['refridgerator'] = "furniture"; + structure_classes['remote control'] = "prop"; + structure_classes['rolled carpet'] = "prop"; + structure_classes['rolled up rug'] = "prop"; + structure_classes['room divider'] = "furniture"; + structure_classes['rope'] = "prop"; + structure_classes['router'] = "prop"; + structure_classes['rug'] = "prop"; + structure_classes['ruler'] = "prop"; + structure_classes['salt and pepper'] = "prop"; + structure_classes['salt container'] = "prop"; + structure_classes['salt shaker'] = "prop"; + structure_classes['saucer'] = "prop"; + structure_classes['scale'] = "prop"; + structure_classes['scarf'] = "prop"; + structure_classes['scenary'] = "prop"; + structure_classes['scissor'] = "prop"; + structure_classes['sculpture'] = "prop"; + structure_classes['security camera'] = "prop"; + structure_classes['server'] = "prop"; + structure_classes['serving dish'] = "prop"; + structure_classes['serving platter'] = "prop"; + structure_classes['serving spoon'] = "prop"; + structure_classes['sewing machine'] = "prop"; + structure_classes['shaver'] = "prop"; + structure_classes['shaving cream'] = "prop"; + structure_classes['sheet'] = "prop"; + structure_classes['sheet music'] = "prop"; + structure_classes['sheet of metal'] = "prop"; + structure_classes['sheets'] = "prop"; + structure_classes['shelves'] = "furniture"; + structure_classes['shirts in hanger'] = "prop"; + structure_classes['shoe'] = "prop"; + structure_classes['shoe rack'] = "prop"; + structure_classes['shoelace'] = "prop"; + structure_classes['shofar'] = "prop"; + structure_classes['shopping baskets'] = "prop"; + structure_classes['shopping cart'] = "prop"; + structure_classes['shorts'] = "prop"; + structure_classes['shovel'] = "prop"; + structure_classes['show piece'] = "prop"; + structure_classes['shower area'] = "structure" + structure_classes['shower base'] = "structure" + structure_classes['shower cap'] = "prop"; + structure_classes['shower curtain'] = "structure" + structure_classes['shower glass'] = "structure" + structure_classes['shower head'] = "prop"; + structure_classes['shower hose'] = "prop"; + structure_classes['shower knob'] = "prop"; + structure_classes['shower pipe'] = "prop"; + structure_classes['shower tube'] = "prop"; + structure_classes['showing plate'] = "prop"; + structure_classes['sifter'] = "prop"; + structure_classes['sign'] = "prop"; + structure_classes['sink'] = "prop"; + structure_classes['sink protector'] = "prop"; + structure_classes['sissors'] = "prop"; + structure_classes['six pack of beer'] = "prop"; + structure_classes['slide'] = "furniture"; + structure_classes['soap'] = "prop"; + structure_classes['soap box'] = "prop"; + structure_classes['soap dish'] = "prop"; + structure_classes['soap holder'] = "prop"; + structure_classes['soap stand'] = "prop"; + structure_classes['soap tray'] = "prop"; + structure_classes['sock'] = "prop"; + structure_classes['sofa'] = "furniture"; + structure_classes['soft toy'] = "prop"; + structure_classes['soft toy group'] = "prop"; + structure_classes['spatula'] = "prop"; + structure_classes['speaker'] = "prop"; + structure_classes['spice bottle'] = "prop"; + structure_classes['spice rack'] = "structure" + structure_classes['spice stand'] = "structure" + structure_classes['sponge'] = "prop"; + structure_classes['spoon'] = "prop"; + structure_classes['spoon sets'] = "prop"; + structure_classes['spoon stand'] = "prop"; + structure_classes['squash'] = "prop"; + structure_classes['squeeze tube'] = "prop"; + structure_classes['stacked bins'] = "prop"; + structure_classes['stacked bins boxes'] = "prop"; + structure_classes['stacked chairs'] = "furniture"; + structure_classes['stacked plastic racks'] = "furniture"; + structure_classes['stairs'] = "structure" + structure_classes['stamp'] = "prop"; + structure_classes['stand'] = "furniture"; + structure_classes['staple remover'] = "prop"; + structure_classes['stapler'] = "prop"; + structure_classes['steamer'] = "prop"; + structure_classes['step stool'] = "prop"; + structure_classes['stereo'] = "prop"; + structure_classes['stick'] = "prop"; + structure_classes['sticker'] = "prop"; + structure_classes['sticks'] = "prop"; + structure_classes['stones'] = "prop"; + structure_classes['stool'] = "prop"; + structure_classes['storage basket'] = "prop"; + structure_classes['storage bin'] = "prop"; + structure_classes['storage box'] = "prop"; + structure_classes['storage chest'] = "furniture"; + structure_classes['storage rack'] = "furniture"; + structure_classes['storage shelvesbooks'] = "furniture"; + structure_classes['storage space'] = "structure" + structure_classes['stove'] = "structure" + structure_classes['stove burner'] = "prop"; + structure_classes['stroller'] = "furniture"; + structure_classes['stuffed animal'] = "prop"; + structure_classes['styrofoam object'] = "prop"; + structure_classes['suger jar'] = "prop"; + structure_classes['suitcase'] = "prop"; + structure_classes['surge protect'] = "prop"; + structure_classes['surge protector'] = "prop"; + structure_classes['switchbox'] = "prop"; + structure_classes['table'] = "furniture"; + structure_classes['table runner'] = "prop"; + structure_classes['tablecloth'] = "prop"; + structure_classes['tag'] = "prop"; + structure_classes['tape'] = "prop"; + structure_classes['tape dispenser'] = "prop"; + structure_classes['tea box'] = "prop"; + structure_classes['tea cannister'] = "prop"; + structure_classes['tea coaster'] = "prop"; + structure_classes['tea kettle'] = "prop"; + structure_classes['tea pot'] = "prop"; + structure_classes['telephone'] = "prop"; + structure_classes['telephone cord'] = "prop"; + structure_classes['telescope'] = "prop"; + structure_classes['television'] = "prop"; + structure_classes['tennis racket'] = "prop"; + structure_classes['tent'] = "furniture"; + structure_classes['thermostat'] = "prop"; + structure_classes['tin foil'] = "prop"; + structure_classes['tissue'] = "prop"; + structure_classes['tissue box'] = "prop"; + structure_classes['tissue roll'] = "prop"; + structure_classes['toaster'] = "prop"; + structure_classes['toaster oven'] = "prop"; + structure_classes['toilet'] = "furniture"; + structure_classes['toilet bowl brush'] = "prop"; + structure_classes['toilet brush'] = "prop"; + structure_classes['toilet holder'] = "prop"; + structure_classes['toilet paper'] = "prop"; + structure_classes['toilet paper holder'] = "prop"; + structure_classes['toilet plunger'] = "prop"; + structure_classes['toiletries'] = "prop"; + structure_classes['toiletries bag'] = "prop"; + structure_classes['toothbrush'] = "prop"; + structure_classes['toothbrush holder'] = "prop"; + structure_classes['toothpaste'] = "prop"; + structure_classes['toothpaste holder'] = "prop"; + structure_classes['torah'] = "prop"; + structure_classes['torch'] = "prop"; + structure_classes['towel'] = "prop"; + structure_classes['towel rod'] = "structure" + structure_classes['toy'] = "prop"; + structure_classes['toy boat'] = "prop"; + structure_classes['toy box'] = "prop"; + structure_classes['toy car'] = "prop"; + structure_classes['toy cash register'] = "prop"; + structure_classes['toy chair'] = "prop"; + structure_classes['toy chest'] = "prop"; + structure_classes['toy cube'] = "prop"; + structure_classes['toy cuboid'] = "prop"; + structure_classes['toy cylinder'] = "prop"; + structure_classes['toy doll'] = "prop"; + structure_classes['toy horse'] = "prop"; + structure_classes['toy house'] = "prop"; + structure_classes['toy kitchen'] = "prop"; + structure_classes['toy phone'] = "prop"; + structure_classes['toy pyramid'] = "prop"; + structure_classes['toy rectangle'] = "prop"; + structure_classes['toy shelf'] = "prop"; + structure_classes['toy sink'] = "prop"; + structure_classes['toy sofa'] = "prop"; + structure_classes['toy table'] = "prop"; + structure_classes['toy tree'] = "prop"; + structure_classes['toy triangle'] = "prop"; + structure_classes['toy truck'] = "prop"; + structure_classes['toy trucks'] = "prop"; + structure_classes['toyhouse'] = "prop"; + structure_classes['toys basket'] = "prop"; + structure_classes['toys box'] = "prop"; + structure_classes['toys rack'] = "furniture"; + structure_classes['toys shelf'] = "furniture"; + structure_classes['track light'] = "structure" + structure_classes['trampoline'] = "furniture"; + structure_classes['travel bag'] = "prop"; + structure_classes['tray'] = "prop"; + structure_classes['treadmill'] = "furniture"; + structure_classes['tree sculpture'] = "structure" + structure_classes['tricycle'] = "prop"; + structure_classes['trivet'] = "prop"; + structure_classes['trolly'] = "furniture"; + structure_classes['trophy'] = "prop"; + structure_classes['tub of tupperware'] = "prop"; + structure_classes['tumbler'] = "prop"; + structure_classes['tuna cans'] = "prop"; + structure_classes['tupperware'] = "prop"; + structure_classes['tv stand'] = "furniture"; + structure_classes['typewriter'] = "prop"; + structure_classes['umbrella'] = "prop"; + structure_classes['unknown'] = "prop"; + structure_classes['urn'] = "prop"; + structure_classes['usb drive'] = "prop"; + structure_classes['utensil'] = "prop"; + structure_classes['utensil container'] = "prop"; + structure_classes['utensils'] = "prop"; + structure_classes['vacuum cleaner'] = "prop"; + structure_classes['vase'] = "prop"; + structure_classes['vasoline'] = "prop"; + structure_classes['vegetable'] = "prop"; + structure_classes['vegetable peeler'] = "prop"; + structure_classes['vegetables'] = "prop"; + structure_classes['ventilation'] = "structure" + structure_classes['vessel'] = "prop"; + structure_classes['vessel set'] = "prop"; + structure_classes['vessels'] = "prop"; + structure_classes['video game'] = "prop"; + structure_classes['vuvuzela'] = "prop"; + structure_classes['waffle maker'] = "prop"; + structure_classes['walkie talkie'] = "prop"; + structure_classes['wall'] = "structure" + structure_classes['wall decoration'] = "prop"; + structure_classes['wall divider'] = "furniture"; + structure_classes['wall hand sanitizer dispenser'] = "prop"; + structure_classes['wall stand'] = "structure" + structure_classes['wallet'] = "prop"; + structure_classes['wardrobe'] = "furniture"; + structure_classes['washing machine'] = "furniture"; + structure_classes['watch'] = "prop"; + structure_classes['water carboy'] = "prop"; + structure_classes['water cooler'] = "furniture"; + structure_classes['water dispenser'] = "prop"; + structure_classes['water filter'] = "prop"; + structure_classes['water fountain'] = "structure" + structure_classes['water heater'] = "prop"; + structure_classes['water purifier'] = "prop"; + structure_classes['watermellon'] = "prop"; + structure_classes['webcam'] = "prop"; + structure_classes['whisk'] = "prop"; + structure_classes['whiteboard'] = "structure" + structure_classes['whiteboard eraser'] = "prop"; + structure_classes['whiteboard marker'] = "prop"; + structure_classes['wii'] = "prop"; + structure_classes['window'] = "structure" + structure_classes['window box'] = "structure" + structure_classes['window cover'] = "structure" + structure_classes['window frame'] = "structure" + structure_classes['window seat'] = "structure" + structure_classes['window shelf'] = "structure" + structure_classes['wine accessory'] = "prop"; + structure_classes['wine bottle'] = "prop"; + structure_classes['wine glass'] = "prop"; + structure_classes['wine rack'] = "prop"; + structure_classes['wiping cloth'] = "prop"; + structure_classes['wire'] = "prop"; + structure_classes['wire basket'] = "prop"; + structure_classes['wire board'] = "prop"; + structure_classes['wire rack'] = "prop"; + structure_classes['wire tray'] = "prop"; + structure_classes['wooden container'] = "prop"; + structure_classes['wooden kitchen utensils'] = "prop"; + structure_classes['wooden pillar'] = "structure" + structure_classes['wooden plank'] = "prop"; + structure_classes['wooden planks'] = "prop"; + structure_classes['wooden toy'] = "prop"; + structure_classes['wooden utensil'] = "prop"; + structure_classes['wooden utensils'] = "prop"; + structure_classes['wreathe'] = "prop"; + structure_classes['xbox'] = "prop"; + structure_classes['yarmulka'] = "prop"; + structure_classes['yellow pepper'] = "prop"; + structure_classes['yoga mat'] = "prop"; + structure_classes['toy bottle'] = "prop"; + structure_classes['lock'] = "prop"; + structure_classes['iphone'] = "prop"; + structure_classes['napkin ring'] = "prop"; + structure_classes['bed sheets'] = "prop"; + structure_classes['spot light'] = "prop"; + structure_classes['mortar and pestle'] = "prop"; + structure_classes['stack of plates'] = "prop"; + structure_classes['suit jacket'] = "prop"; + structure_classes['coat hanger'] = "prop"; + structure_classes['cardboard tube'] = "prop"; + structure_classes['toy bin'] = "prop"; + structure_classes['roll of paper'] = "prop"; + structure_classes['cardboard sheet'] = "prop"; + structure_classes['pyramid'] = "prop"; + structure_classes['toy plane'] = "prop"; + structure_classes['bottle of soap'] = "prop"; + structure_classes['box of paper'] = "prop"; + structure_classes['trolley'] = "prop"; + structure_classes['pool ball'] = "prop"; + structure_classes['alarm'] = "prop"; + structure_classes['cannister'] = "prop"; + structure_classes['ping pong ball'] = "prop"; + structure_classes['ping pong racket'] = "prop"; + structure_classes['roll of toilet paper'] = "prop"; + structure_classes['bottle of listerine'] = "prop"; + structure_classes['bottle of hand wash liquid'] = "prop"; + structure_classes['banana peel'] = "prop"; + structure_classes['heating tray'] = "prop"; + structure_classes['measuring cap'] = "prop"; + structure_classes['bottle of ketcup'] = "prop"; + structure_classes['handle'] = "prop"; + structure_classes['lemon'] = "prop"; + structure_classes['wine'] = "prop"; + structure_classes['boomerang'] = "prop"; + structure_classes['button'] = "prop"; + structure_classes['decorative bowl'] = "prop"; + structure_classes['book holder'] = "prop"; + structure_classes['toy apple'] = "prop"; + structure_classes['toy dog'] = "prop"; + structure_classes['drawer knob'] = "prop"; + structure_classes['shoe hanger'] = "prop"; + structure_classes['figurine'] = "prop"; + structure_classes['soccer ball'] = "prop"; + structure_classes['hand weight'] = "prop"; + structure_classes['sleeping bag'] = "prop"; + structure_classes['trinket'] = "prop"; + structure_classes['hand fan'] = "prop"; + structure_classes['sculpture'] = "prop"; + structure_classes['sculpture of the chrysler building'] = "prop"; + structure_classes['sculpture of the eiffel tower'] = "prop"; + structure_classes['sculpture of the empire state building'] = "prop"; + structure_classes['jeans'] = "prop"; + structure_classes['toy stroller'] = "prop"; + structure_classes['shelf frame'] = "prop"; + structure_classes['cat house'] = "prop"; + structure_classes['can of beer'] = "prop"; + structure_classes['lamp shade'] = "prop"; + structure_classes['bracelet'] = "prop"; + structure_classes['indoor fountain'] = "furniture"; + structure_classes['decorative egg'] = "prop"; + structure_classes['photo album'] = "prop"; + structure_classes['decorative candle'] = "prop"; + structure_classes['walkietalkie'] = "prop"; + structure_classes['floor trim'] = "structure" + structure_classes['mini display platform'] = "prop"; + structure_classes['american flag'] = "prop"; + structure_classes['vhs tapes'] = "prop"; + structure_classes['throw'] = "prop"; + structure_classes['newspapers'] = "prop"; + structure_classes['mantle'] = "structure" + structure_classes['roll of paper towels'] = "prop"; + return structure_classes diff --git a/dataset/test/convert.py b/dataset/test/convert.py new file mode 100644 index 0000000..f38f4f3 --- /dev/null +++ b/dataset/test/convert.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python +####################################################################################### +# The MIT License + +# Copyright (c) 2014 Hannes Schulz, University of Bonn +# Copyright (c) 2013 Benedikt Waldvogel, University of Bonn +# Copyright (c) 2008-2009 Sebastian Nowozin + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +####################################################################################### +# vim: set fileencoding=utf-8 : +# +# Helper script to convert the NYU Depth v2 dataset Matlab file into a set of +# PNG images in the CURFIL dataset format. +# +# See https://github.com/deeplearningais/curfil/wiki/Training-and-Prediction-with-the-NYU-Depth-v2-Dataset + +from __future__ import print_function + +from joblib import Parallel, delayed +from skimage import exposure +from skimage.io import imsave +import h5py +import numpy as np +import os +import png +import scipy.io +import sys + +from _structure_classes import get_structure_classes +import _solarized + + +def process_ground_truth(ground_truth): + colors = dict() + colors["structure"] = _solarized.colors[5] + colors["prop"] = _solarized.colors[8] + colors["furniture"] = _solarized.colors[9] + colors["floor"] = _solarized.colors[1] + shape = list(ground_truth.shape) + [3] + img = np.ndarray(shape=shape, dtype=np.uint8) + for i in xrange(shape[0]): + for j in xrange(shape[1]): + l = ground_truth[i, j] + if (l == 0): + img[i, j] = (0, 0, 0) # background + else: + name = classes[names[l - 1]] + assert name in colors, name + img[i, j] = colors[name] + return img + + +def visualize_depth_image(data): + + data[data == 0.0] = np.nan + + maxdepth = np.nanmax(data) + mindepth = np.nanmin(data) + data = data.copy() + data -= mindepth + data /= (maxdepth - mindepth) + + gray = np.zeros(list(data.shape) + [3], dtype=data.dtype) + data = (1.0 - data) + gray[..., :3] = np.dstack((data, data, data)) + + # use a greenish color to visualize missing depth + gray[np.isnan(data), :] = (97, 160, 123) + gray[np.isnan(data), :] /= 255 + + gray = exposure.equalize_hist(gray) + + # set alpha channel + gray = np.dstack((gray, np.ones(data.shape[:2]))) + gray[np.isnan(data), -1] = 0.5 + + return gray * 255 + + +def convert_image(i, scene, img_depth, image, label): + + idx = int(i) + 1 + if idx in train_images: + train_test = "training" + else: + assert idx in test_images, "index %d neither found in training set nor in test set" % idx + train_test = "testing" + + folder = "%s/%s/%s" % (out_folder, train_test, scene) + if not os.path.exists(folder): + os.makedirs(folder) + + img_depth *= 1000.0 + + png.from_array(img_depth, 'L;16').save("%s/%05d_depth.png" % (folder, i)) + + depth_visualization = visualize_depth_image(img_depth) + + # workaround for a bug in the png module + depth_visualization = depth_visualization.copy() # makes in contiguous + shape = depth_visualization.shape + depth_visualization.shape = (shape[0], np.prod(shape[1:])) + + depth_image = png.from_array(depth_visualization, "RGBA;8") + depth_image.save("%s/%05d_depth_visualization.png" % (folder, i)) + + imsave("%s/%05d_colors.png" % (folder, i), image) + + ground_truth = process_ground_truth(label) + imsave("%s/%05d_ground_truth.png" % (folder, i), ground_truth) + + +if __name__ == "__main__": + + if len(sys.argv) < 4: + print("usage: %s [ ]" % sys.argv[0], file=sys.stderr) + sys.exit(0) + + h5_file = h5py.File(sys.argv[1], "r") + # h5py is not able to open that file. but scipy is + train_test = scipy.io.loadmat(sys.argv[2]) + out_folder = sys.argv[3] + if len(sys.argv) >= 5: + raw_depth = bool(int(sys.argv[4])) + else: + raw_depth = False + + if len(sys.argv) >= 6: + num_threads = int(sys.argv[5]) + else: + num_threads = -1 + + test_images = set([int(x) for x in train_test["testNdxs"]]) + train_images = set([int(x) for x in train_test["trainNdxs"]]) + print("%d training images" % len(train_images)) + print("%d test images" % len(test_images)) + + if raw_depth: + print("using raw depth images") + depth = h5_file['rawDepths'] + else: + print("using filled depth images") + depth = h5_file['depths'] + + print("reading", sys.argv[1]) + + labels = h5_file['labels'] + images = h5_file['images'] + + rawDepthFilenames = [u''.join(unichr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['rawDepthFilenames'][0]] + names = [u''.join(unichr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['names'][0]] + scenes = [u''.join(unichr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]] + rawRgbFilenames = [u''.join(unichr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['rawRgbFilenames'][0]] + classes = get_structure_classes() + + print("processing images") + if num_threads == 1: + print("single-threaded mode") + for i, image in enumerate(images): + print("image", i + 1, "/", len(images)) + convert_image(i, scenes[i], depth[i, :, :].T, image.T, labels[i, :, :].T) + else: + Parallel(num_threads, 5)(delayed(convert_image)(i, scenes[i], depth[i, :, :].T, images[i, :, :].T, labels[i, :, :].T) for i in range(len(images))) + + print("finished") diff --git a/dataset/test/create_test_lmdb.sh b/dataset/test/create_test_lmdb.sh new file mode 100755 index 0000000..f366da9 --- /dev/null +++ b/dataset/test/create_test_lmdb.sh @@ -0,0 +1,29 @@ +#! /bin/bash +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +for f in test_colors/*.png +do + file=$(basename $f) + depthfile="${file/colors/depth}" + printf "$file $depthfile\n" >> list_ordered.txt + +done + +sort --random-sort -o list.txt list_ordered.txt + +awk < list.txt '{printf $1; printf " 0\n"}' > list_color.txt +awk < list.txt '{printf $2; printf " 0\n"}' > list_depth.txt + +rm list.txt +rm list_ordered.txt + +mkdir -p test_lmdb +$1/build/tools/convert_imageset -resize_height 27 -resize_width 37 -gray test_depths/ list_depth.txt test_lmdb/test_depth_37x27.lmdb +$1/build/tools/convert_imageset -resize_height 54 -resize_width 74 -gray test_depths/ list_depth.txt test_lmdb/test_depth_74x54.lmdb +$1/build/tools/convert_imageset -resize_height 218 -resize_width 298 test_colors/ list_color.txt test_lmdb/test_color_298x218.lmdb + +rm list_depth.txt +rm list_color.txt + + diff --git a/dataset/test/crop.py b/dataset/test/crop.py new file mode 100644 index 0000000..7be9706 --- /dev/null +++ b/dataset/test/crop.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz +import numpy as np +import matplotlib.pyplot as plt +import matplotlib +import sys +import PIL +from PIL import Image +import cv2 +import cv +import caffe +import argparse +import os.path +import random +from random import randint + +parser = argparse.ArgumentParser() +#parser.add_argument("color_folder", help="input folder") + +args = parser.parse_args() + +for file in os.listdir("test_data"): + if file.endswith(".png"): + filePath = 'test_data/' + file + + width, height = 640, 480 + newWidth, newHeight = 420, 320 + + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + + img = Image.open(filePath) + img = img.crop((borderX, borderY, width - borderX, height - borderY)) + + + print(filePath) + + if 'depth' in file: + depthArray = np.array(img) + depthArray = depthArray.astype(np.float32) + depthArray /= 65535.0 + depthArray = np.clip(depthArray, 0.0039, 1) + depthArray *= 6.5535 # 1 - 10 meters + + depthArray *= 255 + depthArray = depthArray.astype(np.uint8) + depthNew = Image.fromarray(depthArray) + depthNew.save('test_depths/' + file) + + if 'colors' in file: + img.save('test_colors/' + file) + + + + + + + + diff --git a/dataset/test/process_test.sh b/dataset/test/process_test.sh new file mode 100755 index 0000000..8cc012c --- /dev/null +++ b/dataset/test/process_test.sh @@ -0,0 +1,13 @@ +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +python convert.py nyu_depth_v2_labeled.mat splits.mat out 0 1 +mkdir -p test_data +find out/testing -name *colors.png -exec mv -t test_data {} + +find out/testing -name *depth.png -exec mv -t test_data {} + +mkdir -p test_colors +mkdir -p test_depths + +python crop.py + + diff --git a/dataset/train/create_train_lmdb.sh b/dataset/train/create_train_lmdb.sh new file mode 100755 index 0000000..a6b68a4 --- /dev/null +++ b/dataset/train/create_train_lmdb.sh @@ -0,0 +1,88 @@ +#! /bin/bash +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + + +#Data 0 + +for f in train_colors0/*.png +do + file=$(basename $f) + depthfile="${file/rgb/depth}" + printf "$file $depthfile\n" >> list_ordered.txt + +done + +sort --random-sort -o list.txt list_ordered.txt + +awk < list.txt '{printf $1; printf " 0\n"}' > list_color.txt +awk < list.txt '{printf $2; printf " 0\n"}' > list_depth.txt + +rm list.txt +rm list_ordered.txt + +mkdir train_raw0_lmdb +$1/build/tools/convert_imageset -resize_height 27 -resize_width 37 -gray train_depths0/ list_depth.txt train_raw0_lmdb/train_raw0_depth_37x27.lmdb +$1/build/tools/convert_imageset -resize_height 54 -resize_width 74 -gray train_depths0/ list_depth.txt train_raw0_lmdb/train_raw0_depth_74x54.lmdb +$1/build/tools/convert_imageset -resize_height 218 -resize_width 298 train_colors0/ list_color.txt train_raw0_lmdb/train_raw0_color_298x218.lmdb + +rm list_color.txt +rm list_depth.txt + + +#Data 1 + +for f in train_colors1/*.png +do + file=$(basename $f) + depthfile="${file/rgb/depth}" + printf "$file $depthfile\n" >> list_ordered.txt + +done + +sort --random-sort -o list.txt list_ordered.txt + +awk < list.txt '{printf $1; printf " 0\n"}' > list_color.txt +awk < list.txt '{printf $2; printf " 0\n"}' > list_depth.txt + +rm list.txt +rm list_ordered.txt + +mkdir train_raw1_lmdb +$1/build/tools/convert_imageset -resize_height 27 -resize_width 37 -gray train_depths1/ list_depth.txt train_raw1_lmdb/train_raw1_depth_37x27.lmdb +$1/build/tools/convert_imageset -resize_height 54 -resize_width 74 -gray train_depths1/ list_depth.txt train_raw1_lmdb/train_raw1_depth_74x54.lmdb +$1/build/tools/convert_imageset -resize_height 218 -resize_width 298 train_colors1/ list_color.txt train_raw1_lmdb/train_raw1_color_298x218.lmdb + +rm list_color.txt +rm list_depth.txt + +#Data 1 + +for f in train_colors2/*.png +do + file=$(basename $f) + depthfile="${file/rgb/depth}" + printf "$file $depthfile\n" >> list_ordered.txt + +done + +sort --random-sort -o list.txt list_ordered.txt + +awk < list.txt '{printf $1; printf " 0\n"}' > list_color.txt +awk < list.txt '{printf $2; printf " 0\n"}' > list_depth.txt + +rm list.txt +rm list_ordered.txt + +mkdir train_raw2_lmdb +$1/build/tools/convert_imageset -resize_height 27 -resize_width 37 -gray train_depths2/ list_depth.txt train_raw2_lmdb/train_raw2_depth_37x27.lmdb +$1/build/tools/convert_imageset -resize_height 54 -resize_width 74 -gray train_depths2/ list_depth.txt train_raw2_lmdb/train_raw2_depth_74x54.lmdb +$1/build/tools/convert_imageset -resize_height 218 -resize_width 298 train_colors2/ list_color.txt train_raw2_lmdb/train_raw2_color_298x218.lmdb + +rm list_color.txt +rm list_depth.txt + + + + + diff --git a/dataset/train/get_train_scenes.m b/dataset/train/get_train_scenes.m new file mode 100644 index 0000000..e2790b9 --- /dev/null +++ b/dataset/train/get_train_scenes.m @@ -0,0 +1,19 @@ +% Master's Thesis - Depth Estimation by Convolutional Neural Networks +% Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +data = load('nyu_depth_v2_labeled.mat'); +split = load('splits.mat'); + +for i = 1 : 795 + folders(i) = data.scenes(split.trainNdxs(i)); +end + +folders = unique(folders); +fileID = fopen('train_scenes.txt','w'); + +for i = 1 :numel(folders) + fprintf(fileID, '%s\n', folders{i}); +end + +fclose(fileID); +exit(); diff --git a/dataset/train/process_raw.m b/dataset/train/process_raw.m new file mode 100644 index 0000000..62d522c --- /dev/null +++ b/dataset/train/process_raw.m @@ -0,0 +1,57 @@ +% Master's Thesis - Depth Estimation by Convolutional Neural Networks +% Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +addpath('tools'); + +d = dir('.'); +isub = [d(:).isdir]; %# returns logical vector +nameFolds = {d(isub).name}'; +nameFolds(ismember(nameFolds,{'.','..','tools'})) = []; +nameFolds(~cellfun(@isempty,(regexp(nameFolds,'._out')))) = []; +disp(numel(nameFolds)); + +count = 0; +outCount = 0; +for f = 1:numel(nameFolds) + disp(f); + disp(nameFolds{f}); + files = get_synched_frames(nameFolds{f}); + c = numel(files); + disp(strcat('filecount: ',int2str(c))); + + files = files(1:5:c); + c = numel(files); + disp(strcat('filecount to process: ',int2str(c))); + count = count + c; + + outFolder = strcat(nameFolds{f}, '_out'); + if ~exist(outFolder, 'dir') + mkdir(outFolder); + end + parfor idx = 1:c + rgbFilename = strcat(nameFolds{f},'/',files(idx).rawRgbFilename); + depthFilename = strcat(nameFolds{f},'/',files(idx).rawDepthFilename); + outRGBFilename = strcat(nameFolds{f},'_out/',nameFolds{f},num2str(idx),'rgb.png'); + outDepthFilename = strcat(nameFolds{f},'_out/',nameFolds{f},num2str(idx),'depth.png'); + disp(outRGBFilename); + rgb = imread(rgbFilename); + depth = imread(depthFilename); + depth = swapbytes(depth);% + [depthOut, rgbOut] = project_depth_map(depth, rgb); + imgDepth = fill_depth_colorization(double(rgbOut) / 255.0, depthOut, 0.8); + imgDepth = imgDepth / 10.0; + imgDepth = crop_image(imgDepth); + rgbOut = crop_image(rgbOut); + imwrite(rgbOut, outRGBFilename); + imwrite(imgDepth, outDepthFilename); + + end + D = dir([outFolder, '/*rgb.png']); + Num = length(D);%D(not([D.isdir]))); + disp(strcat('output filecount: ',int2str(Num))); + outCount = outCount + Num; +end +disp(count); +disp(outCount); + +exit; diff --git a/dataset/train/split_train_set.sh b/dataset/train/split_train_set.sh new file mode 100755 index 0000000..31572b0 --- /dev/null +++ b/dataset/train/split_train_set.sh @@ -0,0 +1,21 @@ +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +echo "Extracting images from training scenes..." +mkdir -p train_data_all +while read i; do + dirpath=${1}'/'${i} + for d in "${dirpath}"*/ + do + cp $d/* -t train_data_all + done +done < train_scenes.txt + +echo "Moving extracted RGB images to train_rgbs..." +mkdir -p train_colors +find train_data_all -name '*rgb.png' -exec mv -t train_colors {} + +echo "Moving extracted Depth images to train_depths..." +mkdir -p train_depths +find train_data_all -name '*depth.png' -exec mv -t train_depths {} + +rm -r train_data_all + diff --git a/dataset/train/train_augment0.py b/dataset/train/train_augment0.py new file mode 100644 index 0000000..a3a0f07 --- /dev/null +++ b/dataset/train/train_augment0.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +import numpy as np +import sys +import PIL +from PIL import Image +import os.path +import random +from random import randint + +try: + os.mkdir('train_colors0') +except OSError: + print('output folder already exists') +try: + os.mkdir('train_depths0') +except OSError: + print('output folder already exists') + +counter = 1 +for file in os.listdir("train_colors"): + if file.endswith(".png"): + depthFile = file.replace('rgb','depth') + filePath = 'train_colors/' + file + depthFilePath = 'train_depths/' + depthFile + print(str(counter) + filePath + ' ' + depthFilePath) + counter += 1 + + colorOriginal = Image.open(filePath) + depthOriginal = Image.open(depthFilePath) + + width, height = 561, 427 + newWidth, newHeight = 420, 320 + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + + colorNew = colorOriginal.crop((borderX, borderY, width - borderX, height - borderY)) + depthNew = depthOriginal.crop((borderX, borderY, width - borderX, height - borderY)) + + colorNew.save('train_colors0/' + file) + depthNew.save('train_depths0/' + depthFile) + + + + + diff --git a/dataset/train/train_augment1.py b/dataset/train/train_augment1.py new file mode 100644 index 0000000..4d9d1e0 --- /dev/null +++ b/dataset/train/train_augment1.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +import numpy as np +import sys +import PIL +from PIL import Image +import os.path +import random +from random import randint + +try: + os.mkdir('train_colors1') +except OSError: + print('output folder already exists') +try: + os.mkdir('train_depths1') +except OSError: + print('output folder already exists') + +counter = 1 +for file in os.listdir("train_colors"): + if file.endswith(".png"): + depthFile = file.replace('rgb','depth') + filePath = 'train_colors/' + file + depthFilePath = 'train_depths/' + depthFile + print(str(counter) + filePath + ' ' + depthFilePath) + counter += 1 + colorOriginal = Image.open(filePath) + depthOriginal = Image.open(depthFilePath) + + rotation_std = 2.5 + + + filename = os.path.splitext(file)[0] + depthFilename = os.path.splitext(depthFile)[0] + + for i in range(5): + + color = colorOriginal + depth = depthOriginal + + width, height = 561, 427 + newWidth, newHeight = 420, 320 + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + if randint(0,2) == 0: + randomTranslationX = 0 + randomTranslationY = 0 + randomAngle = np.random.normal(0.0, rotation_std) + color = color.rotate(randomAngle) + depth = depth.rotate(randomAngle) + else: + randomScale = random.uniform(0.875, 1.125) + resizeWidth, resizeHeight = int(randomScale * width), int(randomScale * height) + color = color.resize((resizeWidth, resizeHeight), PIL.Image.ANTIALIAS) + depth = depth.resize((resizeWidth, resizeHeight), PIL.Image.ANTIALIAS) + depthArray = np.array(depth) + depthArray = depthArray.astype(np.float32) + depthArray /= randomScale + depthArray = np.clip(depthArray, 0.0, 255.0) + depthArray = depthArray.astype(np.uint8) + depth = Image.fromarray(depthArray) + + width, height = color.size + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + + randomTranslationX = randint(-borderX + 1,borderX-1) + randomTranslationY = randint(-borderY + 1,borderY-1) + + colorNew = color.crop((borderX + randomTranslationX, borderY + randomTranslationY,width - borderX + randomTranslationX, height - borderY + randomTranslationY)) + depthNew = depth.crop((borderX + randomTranslationX, borderY + randomTranslationY,width - borderX + randomTranslationX, height - borderY + randomTranslationY)) + + colorArray = np.array(colorNew) + colorArray = colorArray.astype(np.float32) / 255.0 + colorArray = matplotlib.colors.rgb_to_hsv(colorArray) + randomHueShift = random.uniform(-0.05,0.05) + colorArray[:,:,0] += randomHueShift + colorArray[:,:,0] = np.mod(colorArray[:,:,0], 1.0) + randomSaturationShift = random.uniform(-0.05,0.05) + colorArray[:,:,1] += randomSaturationShift + colorArray[:,:,1] = np.clip(colorArray[:,:,1], 0, 1) + randomValueShift = random.uniform(-0.05,0.05) + colorArray[:,:,2] += randomValueShift + colorArray[:,:,2] = np.clip(colorArray[:,:,2], 0, 1) + colorArray = matplotlib.colors.hsv_to_rgb(colorArray) * 255.0 + + randomContrastChange = random.uniform(205.0,305.0) + colorArray *= randomContrastChange / 255.0 + colorArray -= (randomContrastChange - 255.0) / 2.0 + colorArray = np.clip(colorArray, 0, 255.0) + colorArray = colorArray.astype(np.uint8) + colorNew = Image.fromarray(colorArray) + + colorNew.save('train_colors1/' + filename + str(i) + '.png') + depthNew.save('train_depths1/' + depthFilename + str(i) + '.png') + + colorNewH = colorNew.transpose(PIL.Image.FLIP_LEFT_RIGHT) + depthNewH = depthNew.transpose(PIL.Image.FLIP_LEFT_RIGHT) + colorNewH.save('train_colors1/' + filename + str(i) + 'f.png') + depthNewH.save('train_depths1/' + depthFilename + str(i) + 'f.png') + + + + + diff --git a/dataset/train/train_augment2.py b/dataset/train/train_augment2.py new file mode 100644 index 0000000..a9704c4 --- /dev/null +++ b/dataset/train/train_augment2.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# Master's Thesis - Depth Estimation by Convolutional Neural Networks +# Jan Ivanecky; xivane00@stud.fit.vutbr.cz + +import numpy as np +import sys +import PIL +from PIL import Image +import os.path +import random +from random import randint + +try: + os.mkdir('train_colors2') +except OSError: + print('output folder already exists') +try: + os.mkdir('train_depths2') +except OSError: + print('output folder already exists') + +counter = 1 +for file in os.listdir("train_colors"): + if file.endswith(".png"): + depthFile = file.replace('rgb','depth') + filePath = 'train_colors/' + file + depthFilePath = 'train_depths/' + depthFile + print(str(counter) + filePath + ' ' + depthFilePath) + counter += 1 + colorOriginal = Image.open(filePath) + depthOriginal = Image.open(depthFilePath) + + rotation_std = 5.0 + + + filename = os.path.splitext(file)[0] + depthFilename = os.path.splitext(depthFile)[0] + + for i in range(5): + + color = colorOriginal + depth = depthOriginal + + width, height = 561, 427 + newWidth, newHeight = 420, 320 + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + if randint(0,2) == 0: + randomTranslationX = 0 + randomTranslationY = 0 + randomAngle = np.random.normal(0.0, rotation_std) + color = color.rotate(randomAngle) + depth = depth.rotate(randomAngle) + else: + randomScale = random.uniform(0.75, 1.25) + resizeWidth, resizeHeight = int(randomScale * width), int(randomScale * height) + color = color.resize((resizeWidth, resizeHeight), PIL.Image.ANTIALIAS) + depth = depth.resize((resizeWidth, resizeHeight), PIL.Image.ANTIALIAS) + depthArray = np.array(depth) + depthArray = depthArray.astype(np.float32) + depthArray /= randomScale + depthArray = np.clip(depthArray, 0.0, 255.0) + depthArray = depthArray.astype(np.uint8) + depth = Image.fromarray(depthArray) + + width, height = color.size + borderX = (width - newWidth) / 2 + borderY = (height - newHeight) / 2 + + if borderX <= 1: + randomTranslationX = 0 + randomTranslationY = 0 + else: + randomTranslationX = randint(-borderX + 1,borderX-1) + randomTranslationY = randint(-borderY + 1,borderY-1) + + colorNew = color.crop((borderX + randomTranslationX, borderY + randomTranslationY,width - borderX + randomTranslationX, height - borderY + randomTranslationY)) + depthNew = depth.crop((borderX + randomTranslationX, borderY + randomTranslationY,width - borderX + randomTranslationX, height - borderY + randomTranslationY)) + + colorArray = np.array(colorNew) + colorArray = colorArray.astype(np.float32) / 255.0 + colorArray = matplotlib.colors.rgb_to_hsv(colorArray) + randomHueShift = random.uniform(-0.1,0.1) + colorArray[:,:,0] += randomHueShift + colorArray[:,:,0] = np.mod(colorArray[:,:,0], 1.0) + randomSaturationShift = random.uniform(-0.1,0.1) + colorArray[:,:,1] += randomSaturationShift + colorArray[:,:,1] = np.clip(colorArray[:,:,1], 0, 1) + randomValueShift = random.uniform(-0.1,0.1) + colorArray[:,:,2] += randomValueShift + colorArray[:,:,2] = np.clip(colorArray[:,:,2], 0, 1) + colorArray = matplotlib.colors.hsv_to_rgb(colorArray) * 255.0 + + randomContrastChange = random.uniform(175.0,335.0) + colorArray *= randomContrastChange / 255.0 + colorArray -= (randomContrastChange - 255.0) / 2.0 + colorArray = np.clip(colorArray, 0, 255.0) + colorArray = colorArray.astype(np.uint8) + colorNew = Image.fromarray(colorArray) + + colorNew.save('train_colors2/' + filename + str(i) + '.png') + depthNew.save('train_depths2/' + depthFilename + str(i) + '.png') + + colorNewH = colorNew.transpose(PIL.Image.FLIP_LEFT_RIGHT) + depthNewH = depthNew.transpose(PIL.Image.FLIP_LEFT_RIGHT) + colorNewH.save('train_colors2/' + filename + str(i) + 'f.png') + depthNewH.save('train_depths2/' + depthFilename + str(i) + 'f.png') + +