Кто -нибудь знает ли кто -нибудь, почему мои коробки выглядят так? модель с разными опсами несколько раз, но ничего не исправляет. < /p>
Вы можете увидеть ошибку в IMG < /p>
[![enter image description here][1]][1]
#include
#include
#include
#include
#include
using namespace cv;
using namespace dnn;
using namespace std;
inline float sigmoid(float x) {
return 1.0f / (1.0f + exp(-x));
}
int main() {
string modelPath = "C:/Users/shlomi/yolo11x.onnx";
string imagePath = "C:/Users/shlomi/test.jpg"; // Change to your image path
Net net = readNet(modelPath);
net.setPreferableBackend(DNN_BACKEND_CUDA);
net.setPreferableTarget(DNN_TARGET_CUDA);
Mat frame = imread(imagePath);
if (frame.empty()) {
cerr confThreshold && class_id >= 0) {
conf = std::max(0.f, std::min(conf, 1.f));
float x = data[0];
float y = data[1];
float w = data[2];
float h = data[3];
int left = int((x - 0.5 * w));
int top = int((y - 0.5 * h));
int width = int(w);
int height = int(h);
left = std::max(0, left);
top = std::max(0, top);
width = std::min(640 - left, width);
height = std::min(640 - top, height);
boxes.emplace_back(left, top, width, height);
classIds.push_back(class_id);
confidences.push_back(conf);
}
}
vector indices;
NMSBoxes(boxes, confidences, confThreshold, iouThreshold, indices);
for (int idx : indices) {
Rect box = boxes[idx];
int class_id = classIds[idx];
float conf = confidences[idx];
rectangle(resized, box, Scalar(0, 255, 0), 2);
string label = format("id:%d %.2f", class_id, conf);
putText(resized, label, Point(box.x, max(box.y - 5, 0)), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
}
imshow("YOLOv8 Object Detection", resized);
imwrite("result.jpg", resized); // Output always 640x640
waitKey(0);
destroyAllWindows();
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... play-issue
Проблема дисплея с ограничивающей коробкой [закрыто] ⇐ C++
Программы на C++. Форум разработчиков
-
Anonymous
1753210333
Anonymous
Кто -нибудь знает ли кто -нибудь, почему мои коробки выглядят так? модель с разными опсами несколько раз, но ничего не исправляет. < /p>
Вы можете увидеть ошибку в IMG < /p>
[![enter image description here][1]][1]
#include
#include
#include
#include
#include
using namespace cv;
using namespace dnn;
using namespace std;
inline float sigmoid(float x) {
return 1.0f / (1.0f + exp(-x));
}
int main() {
string modelPath = "C:/Users/shlomi/yolo11x.onnx";
string imagePath = "C:/Users/shlomi/test.jpg"; // Change to your image path
Net net = readNet(modelPath);
net.setPreferableBackend(DNN_BACKEND_CUDA);
net.setPreferableTarget(DNN_TARGET_CUDA);
Mat frame = imread(imagePath);
if (frame.empty()) {
cerr confThreshold && class_id >= 0) {
conf = std::max(0.f, std::min(conf, 1.f));
float x = data[0];
float y = data[1];
float w = data[2];
float h = data[3];
int left = int((x - 0.5 * w));
int top = int((y - 0.5 * h));
int width = int(w);
int height = int(h);
left = std::max(0, left);
top = std::max(0, top);
width = std::min(640 - left, width);
height = std::min(640 - top, height);
boxes.emplace_back(left, top, width, height);
classIds.push_back(class_id);
confidences.push_back(conf);
}
}
vector indices;
NMSBoxes(boxes, confidences, confThreshold, iouThreshold, indices);
for (int idx : indices) {
Rect box = boxes[idx];
int class_id = classIds[idx];
float conf = confidences[idx];
rectangle(resized, box, Scalar(0, 255, 0), 2);
string label = format("id:%d %.2f", class_id, conf);
putText(resized, label, Point(box.x, max(box.y - 5, 0)), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
}
imshow("YOLOv8 Object Detection", resized);
imwrite("result.jpg", resized); // Output always 640x640
waitKey(0);
destroyAllWindows();
return 0;
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79710937/bounding-box-display-issue[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия