安装miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh -b -u -p ~/miniconda3
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
然后
~/miniconda3/bin/conda init bash
查看可用的虚拟环境
conda env list
创建新的虚拟环境
conda create -n python311 python=3.11
激活新的环境
conda activate python311
安装yolov8
pip install ultralytics
安装onnxruntime
pip install onnxruntime
安装torch
pip install torch torchvision torchaudio
命令行推理
yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
各种模型下载地址:
https://github.com/ultralytics/assets/releases/tag/v0.0.0
编译opencv4.8.1
wget https://github.com/opencv/opencv/archive/refs/tags/4.8.1.zip
wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.8.1.zip
unzip opencv-4.8.1.zip
unzip opencv_contrib-4.8.1.zip
docker pull ubuntu:22.04
docker ps -a
docker run -itd ubuntu:22.04 /bin/bash
ee82839b65bb0c9cbb02079c7df4068ff76df9eab3e5a95674491a5fa118d453
docker cp opencv-4.8.1.zip ee:/home/hesy
docker cp opencv_contrib-4.8.1.zip ee:/home/hesy
docker exec -it ee /bin/bash
在docker中操作.
cd /home/hesy
unzip opencv-4.8.1.zip
unzip opencv_contrib-4.8.1.zip
mkdir build && cd build
cmake ../opencv-4.8.1 -G Ninja -DCMAKE_INSTALL_PREFIX=/home/hesy/opencv481 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.8.1/modules
ninja -j8
ninja install
opencv测试示例:
#include "bits/stdc++.h"
#include <opencv2/opencv.hpp>
using namespace std;
int main(int argc, char* argv[]){
printf("Hello World\n");
cout<<CV_VERSION<<endl;
return 0;
}
YOLOv8 box_loss cls_loss是什么意思
在分析YOLOv8模型训练过程中的损失函数和性能指标图像时,我们首先观察到的是三个主要损失函数——box_loss、cls_loss和dfl_loss——在训练集上的表现。box_loss负责预测边界框的精确位置,cls_loss用于分类准确性,而dfl_loss通常关联于模型预测边界框的分布。所有这些损失函数随着训练的进行都呈现出下降趋势,这表明模型在学习过程中不断提高了对目标检测任务的准确性。特别是,在训练的初期,损失迅速减少,这表明模型快速捕捉到了数据的关键特征。随着训练的深入,损失下降速度放缓,这是模型逐步接近其性能极限的正常表现。
在验证集上,我们同样看到了类似的损失下降趋势,这证明了模型具有良好的泛化能力。box_loss在验证集上的表现稍微高于训练集,这是正常现象,因为验证数据未参与训练,模型在这部分数据上的表现通常会略差一些。然而,cls_loss和dfl_loss在验证集上的表现与训练集相近,这说明模型在类别识别和边界框分布预测方面具备稳健的泛化能力
Precision和Recall两个指标为我们提供了模型预测准确性的重要视角。Precision指的是模型预测为正的样本中真正为正的比例,而Recall则是模型正确识别的正样本占所有真正正样本的比例。从图中可以看出,两个指标都随着训练的进行而波动上升,显示了模型在正确识别和分类目标方面的逐步改进。尤其是Recall的显著提升,表明模型在不遗漏正样本方面做得越来越好。
mAP50和mAP50-95是衡量目标检测模型性能的重要指标。mAP50是指在IoU(交并比)阈值为0.5时的平均精度,而mAP50-95是在IoU从0.5到0.95的范围内的平均精度。这两个指标的提高意味着模型在不同程度的边界框重叠条件下都能保持较高的性能。
在目标检测系统中,F1分数是精确度和召回率的调和平均,它是评价分类模型性能的重要指标,特别适合于类别分布不平衡的情况。F1分数的范围从0到1,1代表完美的精确度和召回率,而0代表最差的性能。
详细介绍: https://zhuanlan.zhihu.com/p/686213692
yolov8 训练集与验证集能一样吗
The training and validation sets are used during training.
for each epoch
for each training data instance
propagate error through the network
adjust the weights
calculate the accuracy over training data
for each validation data instance
calculate the accuracy over the validation data
if the threshold validation accuracy is met
exit training
else
continue training
Once you're finished training, then you run against your testing set and verify that the accuracy is sufficient.
Training Set: this data set is used to adjust the weights on the neural network.
Validation Set: this data set is used to minimize overfitting. You're not adjusting the weights of the network with this data set, you're just verifying that any increase in accuracy over the training data set actually yields an increase in accuracy over a data set that has not been shown to the network before, or at least the network hasn't trained on it (i.e. validation data set). If the accuracy over the training data set increases, but the accuracy over the validation data set stays the same or decreases, then you're overfitting your neural network and you should stop training.
Testing Set: this data set is used only for testing the final solution in order to confirm the actual predictive power of the network.
来源:https://stackoverflow.com/questions/2976452/whats-is-the-difference-between-train-validation-and-test-set-in-neural-netwo