Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheat committed May 14, 2023
1 parent 448e8bc commit 83374b7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pylabel/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def voc_xml_file_creation(
folder=True,
occluded=True,
):

index = 0
df_smaller = data[data["img_filename"] == file_name].reset_index()

Expand Down Expand Up @@ -381,7 +380,10 @@ def voc_xml_file_creation(
return output_file_path

# Loop through all images in the dataframe and call voc_xml_file_creation for each one
pbar = tqdm(desc="Exporting VOC files...", total=len(list(set(self.dataset.df.img_filename))))
pbar = tqdm(
desc="Exporting VOC files...",
total=len(list(set(self.dataset.df.img_filename))),
)
for file_title in list(set(self.dataset.df.img_filename)):
file_name = Path(file_title)
file_name = str(file_name.with_suffix(".xml"))
Expand Down Expand Up @@ -513,7 +515,6 @@ def ExportToYoloV5(

# If segmentation = False then export bounding boxes
if segmentation == False:

yolo_dataset["center_x_scaled"] = (
yolo_dataset["ann_bbox_xmin"] + (yolo_dataset["ann_bbox_width"] * 0.5)
) / yolo_dataset["img_width"]
Expand Down Expand Up @@ -561,7 +562,6 @@ def ExportToYoloV5(

# If segmentation = false then output bounding boxes
if segmentation == False:

df_single_img_annots.to_csv(
destination,
index=False,
Expand All @@ -583,7 +583,7 @@ def ExportToYoloV5(
with open(destination, "w") as file:
# Create one row per row in the data frame
for i in range(0, df_single_img_annots.shape[0]):
row = df_single_img_annots.iloc[i].cat_id
row = str(df_single_img_annots.iloc[i].cat_id)
segmentation_array = df_single_img_annots.iloc[
i
].ann_segmentation[0]
Expand Down Expand Up @@ -726,7 +726,6 @@ def ExportToCoco(self, output_path=None, cat_id_index=None):

# Skip this if cat_id is na
if not pd.isna(df["cat_id"][i]):

annotations = [
{
"image_id": df["img_id"][i],
Expand Down

0 comments on commit 83374b7

Please sign in to comment.