Yolo Vision Shenzhen
Shenzhen
Jetzt beitreten
Glossar

Sigmoid-

Learn how the Sigmoid function acts as a squashing activation function in deep learning. Explore its role in binary classification and [YOLO26](https://docs.ultralytics.com/models/yolo26/) models.

Die Sigmoid-Funktion ist eine grundlegende mathematische Komponente, die in den Bereichen maschinelles Lernen (ML) und Deep Learning (DL) häufig verwendet wird. Sie wird oft als „Quetschfunktion“ bezeichnet und nimmt jede reelle Zahl als Eingabe und ordnet ihr einen Wert zwischen 0 und 1 zu. Diese charakteristische S-förmige Kurve macht sie unglaublich nützlich für die Umwandlung von rohen Modellausgaben in interpretierbare Wahrscheinlichkeiten. Im Kontext eines neuronalen Netzes (NN) fungiert die Sigmoid-Funktion als Aktivierungsfunktion und führt eine Nichtlinearität ein, die es Modellen ermöglicht, komplexe Muster jenseits einfacher linearer Beziehungen zu lernen. Obwohl sie in tiefen versteckten Schichten weitgehend durch andere Funktionen ersetzt wurde, bleibt sie eine Standardwahl für Ausgabeschichten in binären Klassifizierungsaufgaben.

Die Mechanismen von Sigmoid in der KI

Im Kern transformiert die Sigmoid-Funktion Eingabedaten – oft als Logits bezeichnet – in einen normalisierten Bereich. Diese Transformation ist entscheidend für Aufgaben, bei denen das Ziel darin besteht, die Wahrscheinlichkeit eines Ereignisses vorherzusagen. Durch die Begrenzung der Ausgabe zwischen 0 und 1 liefert die Funktion einen eindeutigen Wahrscheinlichkeitswert.

  • Logistische Regression: In der traditionellen statistischen Modellierung ist Sigmoid der Motor hinter der logistischen Regression. Es ermöglicht Datenwissenschaftlern, die Wahrscheinlichkeit eines binären Ergebnisses abzuschätzen, z. B. ob ein Kunde abwandert oder bleibt.
  • Binäre Klassifizierung: Bei neuronalen Netzen, die zur Unterscheidung zwischen zwei Klassen (z. B. „Katze” vs. „Hund”) entwickelt wurden, wird in der letzten Schicht häufig eine Sigmoid-Aktivierung verwendet. Ist die Ausgabe größer als ein Schwellenwert (üblicherweise 0,5), sagt das Modell die positive Klasse voraus.
  • Multi-Label-Klassifizierung: Im Gegensatz zu Multi-Class-Problemen, bei denen sich die Klassen gegenseitig ausschließen, können bei Multi-Label-Aufgaben ein Bild oder ein Text gleichzeitig mehreren Kategorien zugeordnet werden. Hier wird Sigmoid unabhängig auf jeden Ausgabeknoten angewendet, sodass ein Modell detect „Auto” und eine „Person” in derselben Szene ohne Konflikt detect .

Key Differences from Other Activation Functions

While Sigmoid was once the default for all layers, researchers discovered limitations like the vanishing gradient problem, where gradients become too small to update weights effectively in deep networks. This led to the adoption of alternatives for hidden layers.

  • Sigmoid vs. ReLU (Rectified Linear Unit): ReLU is computationally faster and avoids vanishing gradients by outputting the input directly if positive, and zero otherwise. It is the preferred choice for hidden layers in modern architectures like YOLO26, whereas Sigmoid is reserved for the final output layer in specific tasks.
  • Sigmoid vs. Softmax: Both map outputs to a 0-1 range, but they serve different purposes. Sigmoid treats each output independently, making it ideal for binary or multi-label tasks. Softmax forces all outputs to sum to 1, creating a probability distribution used for multi-class classification where only one class is correct.

Anwendungsfälle in der Praxis

The utility of the Sigmoid function extends across various industries where probability estimation is required.

  1. Medical Diagnosis: AI models used in medical image analysis often use Sigmoid outputs to predict the probability of a disease being present in an X-ray or MRI scan. For example, a model might output 0.85, indicating an 85% likelihood of a tumor, aiding doctors in early detection.
  2. Spam Detection: Email filtering systems utilize natural language processing (NLP) models with Sigmoid classifiers to determine if an incoming message is "spam" or "not spam." The model analyzes keywords and metadata, outputting a score that determines whether the email lands in the inbox or the junk folder.

Praktische Umsetzung

You can observe how Sigmoid transforms data using PyTorch, a popular library for building deep learning models. This simple example demonstrates the "squashing" effect on a range of input values.

import torch
import torch.nn as nn

# Create a Sigmoid layer
sigmoid = nn.Sigmoid()

# Define input data (logits) ranging from negative to positive
input_data = torch.tensor([-5.0, -1.0, 0.0, 1.0, 5.0])

# Apply Sigmoid to squash values between 0 and 1
output = sigmoid(input_data)

print(f"Input: {input_data}")
print(f"Output: {output}")
# Output values near 0 for negative inputs, 0.5 for 0, and near 1 for positive inputs

For those looking to train models that utilize these concepts without writing low-level code, the Ultralytics Platform offers an intuitive interface to manage datasets and train state-of-the-art models like YOLO26. By handling the architectural complexities automatically, it allows users to focus on gathering high-quality training data for their specific computer vision applications.

Werden Sie Mitglied der Ultralytics

Gestalten Sie die Zukunft der KI mit. Vernetzen Sie sich, arbeiten Sie zusammen und wachsen Sie mit globalen Innovatoren

Jetzt beitreten