Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add https://www.reddit.com/r/Ultralytics/ badge #63

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> <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>
[![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> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&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
2 changes: 2 additions & 0 deletions detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def detect(opt):


class ConvNetb(nn.Module):
"""Defines a convolutional neural network model with configurable classes and multiple convolutional layers."""

def __init__(self, num_classes=60):
"""Initializes a ConvNetb model with configurable number of classes, defaulting to 60, and a series of
convolutional layers.
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self):


class YOLOLayer(nn.Module):
# YOLO Layer 0
"""Processes YOLO detection layers with specified anchors, classes, and image dimensions for object detection."""

def __init__(self, anchors, nC, img_dim, anchor_idxs):
"""Initializes YOLO layer with given anchors, number of classes, image dimensions, and anchor indexes."""
Expand Down
6 changes: 5 additions & 1 deletion scoring/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def compute_statistics_given_rectangle_matches(groundtruth_rects_matched, rects_
rects_matched: the rects_matched represents a list of integers returned
from the Matching class instance to indicate the matched rectangle
indices from groundtruth_rects for each of the rects.

Returns:
A dictionary holding the computed statistics as well as the inputs.
"""
Expand All @@ -47,6 +48,7 @@ def compute_precision_recall_given_image_statistics_list(iou_threshold, image_st
image_statistics_list: a list of the statistics computed and returned
by the compute_statistics_given_rectangle_matches method for a list of
images.

Returns:
A dictionary holding the precision, recall as well as the inputs.
"""
Expand Down Expand Up @@ -77,6 +79,7 @@ def compute_average_precision_recall_given_precision_recall_dict(precision_recal
compute_precision_recall_given_image_statistics_list method, which is
calculated under a range of iou_thresholds, where the iou_threshold is
the key.

Returns:
average_precision, average_recall.
"""
Expand Down Expand Up @@ -130,15 +133,16 @@ def compute_average_precision_recall(groundtruth_coordinates, coordinates, iou_t
iou_threshold_range: the IOU threshold range to compute the average
precision (AP) and average recall (AR). For example:
iou_threshold_range = [0.50:0.05:0.95]

Returns:
average_precision, average_recall, as well as the precision_recall_dict,
where precision_recall_dict holds the full precision/recall information
for each of the iou_threshold in the iou_threshold_range.

Raises:
ValueError: if the input groundtruth_info_dict and test_info_dict show
inconsistent information.
"""

# Start to build up the Matching instances for each of the image_id_*, which
# is to hold the IOU computation between the rectangle pairs for the same
# image_id_*.
Expand Down
2 changes: 2 additions & 0 deletions scoring/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self, groundtruth_rects, rects):
Args:
groundtruth_rects: a list of groundtruth rectangles.
rects: a list of rectangles to be matched against the groundtruth_rects.

Raises:
ValueError: if any item inside the groundtruth_rects or rects are not
Rectangle type.
Expand Down Expand Up @@ -115,6 +116,7 @@ def cartesian(arrays, out=None):
1-D arrays to form the cartesian product of.
out : ndarray
Array to place the cartesian product in.

Returns
-------
out : ndarray
Expand Down
1 change: 0 additions & 1 deletion scoring/rectangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def area(self):

def intersect(self, other):
"""Returns the intersection of this rectangle with the other rectangle."""

xmin = max(self.xmin_, other.xmin_)
ymin = max(self.ymin_, other.ymin_)
xmax = min(self.xmax_, other.xmax_)
Expand Down
4 changes: 4 additions & 0 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@


class ImageFolder: # for eval-only
"""Loads and preprocesses images from a directory or file for evaluation with batch processing and resizing."""

def __init__(self, path, batch_size=1, img_size=416):
"""Initializes an ImageFolder object to load images from directory or file for evaluation, with customizable
batch size and image size.
Expand Down Expand Up @@ -61,6 +63,8 @@ def __len__(self):


class ListDataset: # for training
"""Loads and processes images and their corresponding labels for training from a specified directory."""

def __init__(self, path, batch_size=1, img_size=608, targets_path=""):
"""Initializes ListDataset for image training with optional batch size and target path, ensuring image path
contains images.
Expand Down
3 changes: 0 additions & 3 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ def compute_ap(recall, precision):
def bbox_iou(box1, box2, x1y1x2y2=True):
# if len(box1.shape) == 1:
# box1 = box1.reshape(1, 4)

"""Returns the IoU of two bounding boxes."""
if x1y1x2y2:
# Get the coordinates of bounding boxes
Expand Down Expand Up @@ -518,7 +517,6 @@ 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()
output = [None for _ in range(len(prediction))]
# Gather bbox priors
Expand Down Expand Up @@ -714,7 +712,6 @@ def secondary_class_detection(x, y, w, h, img, model, device):

def createChips():
"""Generates and saves a dataset of image chips from the xview dataset for classifier training."""

from sys import platform

import cv2
Expand Down