Skip to content

Commit

Permalink
Refactor code for speed and clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jul 5, 2024
1 parent 703cb76 commit 2edd803
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Welcome to the [Ultralytics xView YOLOv3](https://github.com/ultralytics/xview-yolov3) repository! Here we provide code to train the powerful YOLOv3 object detection model on the xView dataset for the [xView Challenge](https://challenge.xviewdataset.org/). This challenge focuses on detecting objects from satellite imagery, advancing the state of the art in computer vision applications for remote sensing.

[![Ultralytics Actions](https://github.com/ultralytics/xview-yolov3/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/xview-yolov3/actions/workflows/format.yml) <a href="https://ultralytics.com/discord"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
[![Ultralytics Actions](https://github.com/ultralytics/xview-yolov3/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/xview-yolov3/actions/workflows/format.yml) <a href="https://ultralytics.com/discord"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>

<img src="https://github-production-user-asset-6210df.s3.amazonaws.com/26833433/238799379-bb3b02f0-dee4-4e67-80ae-4b2378b813ad.jpg?raw=true" width="100%">

Expand Down
1 change: 0 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from collections import defaultdict

import torch.nn as nn

from utils.utils import *


Expand Down
1 change: 0 additions & 1 deletion scoring/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from collections import defaultdict

import numpy as np

from scoring.rectangle import Rectangle


Expand Down
3 changes: 1 addition & 2 deletions scoring/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

import numpy as np
import scipy.io
from tqdm import tqdm

from scoring.matching import Matching
from scoring.rectangle import Rectangle
from tqdm import tqdm

"""
Scoring code to calculate per-class precision and mean average precision.
Expand Down
1 change: 1 addition & 0 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def resize_square(img, height=416, color=(0, 0, 0)): # resizes a rectangular im
def random_affine(
img, targets=None, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-3, 3), borderValue=(0, 0, 0)
):
"""Performs random affine transformations on an image and its target annotations, including rotation, translation, scaling, and shearing."""
# torchvision.transforms.RandomAffine(degrees=(-10, 10), translate=(.1, .1), scale=(.9, 1.1), shear=(-10, 10))
# https://medium.com/uruvideo/dataset-augmentation-with-random-homographies-a8f4b44830d4
border = 750
Expand Down
1 change: 1 addition & 0 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def build_targets(pred_boxes, pred_conf, pred_cls, target, anchor_wh, nA, nC, nG


def non_max_suppression(prediction, conf_thres=0.5, nms_thres=0.4, mat=None, img=None, model2=None, device="cpu"):
"""Performs Non-Maximum Suppression on detection results, filtering out low-confidence detections."""
prediction = prediction.cpu()
"""
Removes detections with lower object confidence score than 'conf_thres' and performs Non-Maximum Suppression to
Expand Down

0 comments on commit 2edd803

Please sign in to comment.