Skip to content

Commit

Permalink
style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Oct 2, 2023
1 parent a9ddc0a commit 0e73f87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deepforest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def use_bird_release(self, check_release=True):
self.config["score_thresh"] = 0.3

# Set label dictionary to Bird
self.label_dict = {"Bird":0}
self.label_dict = {"Bird": 0}
self.numeric_to_label_dict = {v: k for k, v in self.label_dict.items()}

def create_model(self):
Expand Down
14 changes: 8 additions & 6 deletions deepforest/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ def select_annotations(annotations, windows, index, allow_empty=False):
offset = 40
selected_annotations = annotations[(annotations.xmin > (window_xmin - offset)) &
(annotations.xmin < (window_xmax)) &
(annotations.xmax > (window_xmin)) &
(annotations.ymin > (window_ymin - offset)) &
(annotations.xmax >
(window_xmin)) & (annotations.ymin >
(window_ymin - offset)) &
(annotations.xmax < (window_xmax + offset)) &
(annotations.ymin < (window_ymax)) &
(annotations.ymax > (window_ymin)) &
(annotations.ymax < (window_ymax + offset))].copy(
deep=True)
(annotations.ymin <
(window_ymax)) & (annotations.ymax >
(window_ymin)) &
(annotations.ymax <
(window_ymax + offset))].copy(deep=True)
# change the image name
image_basename = os.path.splitext("{}".format(annotations.image_path.unique()[0]))[0]
selected_annotations.image_path = "{}_{}.png".format(image_basename, index)
Expand Down

0 comments on commit 0e73f87

Please sign in to comment.