From bd84184b585e4ebb24a934fb4c37e0b03e7cac86 Mon Sep 17 00:00:00 2001 From: bw4sz Date: Tue, 5 Dec 2023 10:42:10 -0800 Subject: [PATCH] Style changes --- deepforest/main.py | 16 ++++++++-------- deepforest/predict.py | 16 ++++++++-------- deepforest/preprocess.py | 14 +++++++------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/deepforest/main.py b/deepforest/main.py index bf66f368..6157ebed 100644 --- a/deepforest/main.py +++ b/deepforest/main.py @@ -372,14 +372,14 @@ def predict_file(self, csv_file, root_dir, savedir=None, color=None, thickness=1 dataloader = self.predict_dataloader(ds) results = predict._dataloader_wrapper_(model=self, - trainer=self.trainer, - annotations=df, - dataloader=dataloader, - root_dir=root_dir, - nms_thresh=self.config["nms_thresh"], - savedir=savedir, - color=color, - thickness=thickness) + trainer=self.trainer, + annotations=df, + dataloader=dataloader, + root_dir=root_dir, + nms_thresh=self.config["nms_thresh"], + savedir=savedir, + color=color, + thickness=thickness) return results diff --git a/deepforest/predict.py b/deepforest/predict.py index 79254e91..fb92308e 100644 --- a/deepforest/predict.py +++ b/deepforest/predict.py @@ -134,14 +134,14 @@ def across_class_nms(predicted_boxes, iou_threshold=0.15): def _dataloader_wrapper_(model, - trainer, - dataloader, - root_dir, - annotations, - nms_thresh, - savedir=None, - color=None, - thickness=1): + trainer, + dataloader, + root_dir, + annotations, + nms_thresh, + savedir=None, + color=None, + thickness=1): """Create a dataset and predict entire annotation file Csv file format is .csv file with the columns "image_path", "xmin","ymin","xmax","ymax" for the image name and bounding box position. diff --git a/deepforest/preprocess.py b/deepforest/preprocess.py index 0c8ca86f..07a23328 100644 --- a/deepforest/preprocess.py +++ b/deepforest/preprocess.py @@ -146,8 +146,7 @@ def split_raster(annotations_file, patch_overlap=0.05, allow_empty=False, image_name=None, - save_dir="." - ): + save_dir="."): """Divide a large tile into smaller arrays. Each crop will be saved to file. @@ -190,15 +189,16 @@ def split_raster(annotations_file, # Confirm that raster is H x W x C, if not, convert, assuming image is wider/taller than channels if numpy_image.shape[0] < numpy_image.shape[-1]: warnings.warn( - "Input rasterio had shape {}, assuming channels first. Converting to channels last".format( - numpy_image.shape), UserWarning) + "Input rasterio had shape {}, assuming channels first. Converting to channels last" + .format(numpy_image.shape), UserWarning) numpy_image = np.moveaxis(numpy_image, 0, 2) - + # Check that its 3 band bands = numpy_image.shape[2] if not bands == 3: - warnings.warn("Input rasterio had non-3 band shape of {}, ignoring " - "alpha channel".format(numpy_image.shape), UserWarning) + warnings.warn( + "Input rasterio had non-3 band shape of {}, ignoring " + "alpha channel".format(numpy_image.shape), UserWarning) try: numpy_image = numpy_image[:, :, :3].astype("uint8") except: