AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

AI classifications von BIldern

Ein Thema von wschrabi · begonnen am 8. Sep 2023 · letzter Beitrag vom 8. Sep 2023
Antwort Antwort
wschrabi

Registriert seit: 16. Jan 2005
437 Beiträge
 
#1

AI classifications von BIldern

  Alt 8. Sep 2023, 08:21
Liebe Leute,
ich habe mal diesen wizard installiert: chatGPT und nach API KEY Erstellung und Definition diese Frage abgesetzt: Create a class to classify pictures in delphi


Darauf bekam ich dieses REsultat:
Doch meine Frage ist jetzt wie kann man mit LLMs Algorithmen Bilder nach Ähnlichkeiten Klassifizieren. Es geht um BlutgruppenBilder ( HOW-To_Blutgruppen ) , die anfangs manuell den 4 Blutgruppen zugewiesen werden und nach Training einem bei neuen Bildern einen Vorschlag unterbreiten soll.

> Here is an example of how you can create a class in Delphi to classify pictures:


Delphi-Quellcode:
unit PictureClassifier;

interface

uses
  Vcl.Graphics, System.Classes;

type
  TPictureClassifier = class
  private
    FPicture: TPicture;
    FClassification: string;
  public
    constructor Create;
    destructor Destroy; override;
    procedure LoadPicture(const FileName: string);
    procedure ClassifyPicture;
    function GetClassification: string;
  end;

implementation

constructor TPictureClassifier.Create;
begin
  FPicture := TPicture.Create;
end;

destructor TPictureClassifier.Destroy;
begin
  FPicture.Free;
  inherited Destroy;
end;

procedure TPictureClassifier.LoadPicture(const FileName: string);
begin
  FPicture.LoadFromFile(FileName);
end;

procedure TPictureClassifier.ClassifyPicture;
var
  // Add your classification logic here
  // You can use machine learning algorithms, image recognition libraries, etc.
  // For the sake of simplicity, let's assume we are just checking the picture size
  Width, Height: Integer;
begin
  Width := FPicture.Width;
  Height := FPicture.Height;

  if (Width < 100) and (Height < 100) then
    FClassification := 'Small'
  else if (Width < 500) and (Height < 500) then
    FClassification := 'Medium'
  else
    FClassification := 'Large';
end;

function TPictureClassifier.GetClassification: string;
begin
  Result := FClassification;
end;

end.
```

In this example, the `TPictureClassifier` class has a `TPicture` field to hold the picture data and a `FClassification` field to store the classification result. The class provides methods to load a picture, classify it, and retrieve the classification result.

You can customize the `ClassifyPicture` method to implement your specific classification logic, for example, using machine learning algorithms or image recognition libraries.

To use this class, you can create an instance of `TPictureClassifier`, load a picture using the `LoadPicture` method, and then classify it using the `ClassifyPicture` method. Finally, retrieve the classification result using the `GetClassification` method.


Nach einer Erneuten FRAGE mit:
create Classify Picture method to implement your specific classification logic by using machine learning algorithms in delphi

bekam ich das als Antwort.

To create a ClassifyPicture method in Delphi using machine learning algorithms, you can follow the steps below:

Step 1: Set up the Machine Learning model
- First, choose a suitable machine learning algorithm for image classification, such as a Convolutional Neural Network (CNN).
- Next, train the model using labeled image data to learn the patterns and features of different image classes. You can use popular machine learning libraries like TensorFlow, Keras, or Caffe to create and train the model.
- Save the trained model in a format that Delphi can work with, such as a binary or XML file.

Step 2: Load the trained model
- In your Delphi application, load the trained model. This may involve using a specific library or component that supports loading and working with machine learning models, such as the DeepLearnToolbox or PyTorch libraries.

Step 3: Preprocess the input image
- Convert the input image into a format that the trained model can process. This may involve resizing the image, converting it to grayscale, or applying any necessary transformations based on the requirements of the machine learning algorithm used.

Step 4: Classify the image
- Use the loaded model to classify the preprocessed image.
- Provide the image as input to the model and obtain the predicted class or classes. The model should return a probability or confidence score for each class, indicating the certainty of the classification.

Step 5: Return the classification result
- Return the predicted class or classes as the result of the ClassifyPicture method.

Here's a sample code outline demonstrating the above steps:


Delphi-Quellcode:
procedure ClassifyPicture(const imagePath: string): string;
var
  model: TYourMachineLearningModel;
  image: TPreprocessedImage;
  predictedClass: string;
begin
  // Step 2: Load the trained model
  model := LoadModel('path/to/your/model');

  // Step 3: Preprocess the input image
  image := PreprocessImage(imagePath);

  // Step 4: Classify the image
  predictedClass := model.Classify(image);

  // Step 5: Return the classification result
  Result := predictedClass;
end;
Note that the specific implementation details will depend on the machine learning libraries and tools you choose to work with. Make sure to adapt the code accordingly.

Doch wie kann ich das letztendlich Realisieren?
DANKE

Geändert von wschrabi ( 8. Sep 2023 um 08:27 Uhr)
  Mit Zitat antworten Zitat
Klapauzius

Registriert seit: 8. Feb 2018
Ort: Region Bern (Schweiz)
71 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: AI classifications von BIldern

  Alt 8. Sep 2023, 08:45
Embarcadero hat mal in einem Blog darüber geschrieben ist vielleicht interessant:
fastai

ansonsten, frag doch chatgpt spezifisch nach den Schritten. ChatGPT schlägt ja vor Step 1: "...choose a suitable machine learning algorithm"
also nachfragen: which machine learning algorithm do you suggest for delphi?
Albert
  Mit Zitat antworten Zitat
wschrabi

Registriert seit: 16. Jan 2005
437 Beiträge
 
#3

AW: AI classifications von BIldern

  Alt 8. Sep 2023, 08:56
danke ALbert
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz