Skip to content

Commit

Permalink
remove voc reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobsolawetz committed Jun 19, 2023
1 parent ce4a7e2 commit 66c4d58
Showing 1 changed file with 0 additions and 68 deletions.
68 changes: 0 additions & 68 deletions roboflow/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,74 +23,6 @@
from roboflow.util.general import write_line
from roboflow.util.two_stage_utils import ocr_infer

# import xml.dom.minidom
# import xml.etree.ElementTree as ET


# from lxml import etree

# def reorder_bndbox_elements(xml_path):
# parser = etree.XMLParser(remove_blank_text=True)
# tree = etree.parse(xml_path, parser)
# root = tree.getroot()

# for obj in root.findall('object'):
# bndbox = obj.find('bndbox')
# if bndbox is not None:
# xmin = bndbox.find('xmin')
# ymin = bndbox.find('ymin')
# xmax = bndbox.find('xmax')
# ymax = bndbox.find('ymax')

# # Create new bndbox element and append the elements in the order you want
# new_bndbox = etree.Element('bndbox')
# for el in [xmin, xmax, ymin, ymax]:
# if el is not None:
# new_bndbox.append(el)

# # Replace old bndbox with new one
# obj.replace(bndbox, new_bndbox)

# # Write the modified XML back to the file
# with open(xml_path, 'wb') as f:
# f.write(etree.tostring(root, pretty_print=True, xml_declaration=True, encoding='UTF-8'))

# def prettify(dom):
# ugly_xml = dom.toxml()
# pretty_xml = xml.dom.minidom.parseString(ugly_xml).toprettyxml(indent=" ") # 4 spaces
# return pretty_xml

# def remove_extra_newlines(file_path):
# with open(file_path, 'r') as f:
# file_contents = f.read()
# # Use regex to replace multiple consecutive newlines with a single newline
# file_contents = re.sub('\n\s*\n', '\n', file_contents)
# with open(file_path, 'w') as f:
# f.write(file_contents)

# def resave_xml_folder(directory):
# # Iterate through every file in the directory
# for filename in os.listdir(directory):
# if filename.endswith('.xml'): # Check if the file is an XML file
# file_path = os.path.join(directory, filename)

# # Parse XML file
# dom = xml.dom.minidom.parse(file_path)

# # Create pretty xml
# pretty_xml = prettify(dom)

# # Write the prettified XML back to the file
# with open(file_path, 'w') as f:
# f.write(pretty_xml)

# # Remove extra newlines
# remove_extra_newlines(file_path)

# reorder_bndbox_elements(file_path)

# remove_extra_newlines(file_path)


class Workspace:
def __init__(self, info, api_key, default_workspace, model_format):
Expand Down

0 comments on commit 66c4d58

Please sign in to comment.