-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from apoorva-mk/Computer_Vision
Computer vision
- Loading branch information
Showing
3 changed files
with
623 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |