Skip to content

Commit

Permalink
Merge pull request #2 from apoorva-mk/Computer_Vision
Browse files Browse the repository at this point in the history
Computer vision
  • Loading branch information
Nayan committed Jul 30, 2019
2 parents 02cf95a + e657256 commit d443b2f
Show file tree
Hide file tree
Showing 3 changed files with 623 additions and 0 deletions.
476 changes: 476 additions & 0 deletions Data_Collection/Image+Augmentation+Techniques.ipynb

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions Data_Collection/images.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"Records": [
{
"keywords": "washing machine"
},
{
"keywords": "telephone"
},
{
"keywords": "sewing machine"
},
{
"keywords": "radio"
},
{
"keywords": "stereo"
},
{
"keywords": "sofa"
},
{
"keywords": "ceiling fan"
},
{
"keywords": "table fan"
},
{
"keywords": "armchair"
},
{
"keywords": "cattle"
},
{
"keywords": "mattress"
},
{
"keywords": "chair"
},
{
"keywords": "tube light"
},
{
"keywords": "bulb light"
},
{
"keywords": "gas cylinder"
},
{
"keywords": "stove"
},
{
"keywords": "electric iron"
},
{
"keywords": "kitchen sink"
},
{
"keywords": "desktop computer"
},
{
"keywords": "food mixer"
},
{
"keywords": "food processor"
},
{
"keywords": "pressure cooker"
},
{
"keywords": "cars"
},
{
"keywords": "bicycles"
},
{
"keywords": "motorcycles"
},
{
"keywords": "vacuum cleaner"
},
{
"keywords": "thermos flask"
},
{
"keywords": "dish antenna"
},
{
"keywords": "firewood"
},
{
"keywords": "brick wall"
},
{
"keywords": "stone wall"
},
{
"keywords": "mud walls"
},
{
"keywords": "wardrobe"
},
{
"keywords": "oven"
},
{
"keywords": "microwave oven"
}
]
}
38 changes: 38 additions & 0 deletions Data_Collection/xml_to_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET

def xml_to_csv(path):
xml_list = []
for xml_file in glob.glob(path + '/*.xml'):
tree = ET.parse(xml_file)
root = tree.getroot()
for member in root.findall('object'):
value = (
"UNASSIGNED",
root.find('filename').text,
member[0].text,
int(member[4][0].text)/int(root.find('size')[0].text),
int(member[4][1].text)/int(root.find('size')[1].text),
None,
None,
int(member[4][2].text)/int(root.find('size')[0].text),
int(member[4][3].text)/int(root.find('size')[1].text),
None,
None
)
xml_list.append(value)
#column_name = ['filename', 'width', 'height', 'class', 'xmin', 'ymin', 'xmax', 'ymax']
column_name = ['','filename','class','xmin', 'ymin','','','xmax', 'ymax','','']
xml_df = pd.DataFrame(xml_list, columns=column_name)
return xml_df

def main():
image_path = os.path.join(os.getcwd(), 'annotations')
xml_df = xml_to_csv(image_path)
xml_df.to_csv('raccoon_labels.csv', index=None)
print('Successfully converted xml to csv.')


main()

0 comments on commit d443b2f

Please sign in to comment.