2024年华为杯数学建模E题-高速公路应急车道启用建模-基于YOLO8的数据处理代码参考(无偿分享)

利用YOLO模型进行高速公路交通流量分析


识别效果:
在这里插入图片描述

免责声明

本文所提供的信息和内容仅供参考。尽管我尽力确保所提供信息的准确性和可靠性,但我们不对其完整性、准确性或及时性作出任何保证。使用本文信息所造成的任何直接或间接损失,本人概不负责。请在做出任何决策之前自行进行必要的研究和咨询专业人士。

无偿提供代码,感谢点赞收藏关注


随着交通管理的日益重要,自动化监测系统的需求也随之增加。利用计算机视觉技术,我们可以高效地分析视频中的车辆流量,提升交通管理的科学性和有效性。本文将详细介绍如何使用YOLO(You Only Look Once)模型分析高速公路的交通流,结合视频数据提取车辆信息、速度计算和流量分析。整个过程将结合代码,逐步解析每个步骤的细节及其背后的原理。

1. 问题背景

在交通流量分析中,实时监测和处理车辆数据是一个具有挑战性的任务。我们希望能够快速且准确地识别视频中的车辆,并计算它们的速度、流量和密度。为此,我们将使用YOLO模型来进行目标检测,结合一些图像处理技术,分析交通状况。

2. 准备工作

在开始之前,我们需要确保安装必要的库,包括OpenCV、Pandas、NumPy、YOLO等。以下是我们将用到的库:

import cv2
import pandas as pd
import numpy as np
from ultralytics import YOLO
from datetime import datetime
from scipy.spatial import distance

3. 计算视频时长

首先,我们需要计算视频的时长,以便在后续处理中使用。以下是计算视频时长的函数:

def calculate_duration(start_time, end_time):fmt = '%H:%M:%S'start = datetime.strptime(start_time, fmt)end = datetime.strptime(end_time, fmt)duration = end - startreturn duration

在这个函数中,我们使用datetime模块将输入的开始时间和结束时间转换为datetime对象,并计算它们之间的差值,这就是视频的总时长。

4. 获取视频信息

我们需要从视频中提取一些关键信息,例如总帧数、帧率和每帧的时间间隔。可以使用以下函数来实现:

def get_video_info(video_path, duration):cap = cv2.VideoCapture(video_path)if not cap.isOpened():raise ValueError("无法打开视频文件")total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))fps = cap.get(cv2.CAP_PROP_FPS)frame_time = 1 / fps if fps > 0 else 0interval_time = duration.total_seconds() / total_frames if total_frames > 0 else 0cap.release()return total_frames, fps, frame_time, interval_time

这个函数会返回视频的总帧数、帧率、每帧时间以及每帧之间的时间间隔,供后续处理使用。

初始化路径和视频时长

接下来,我们需要初始化视频路径和时长:

video_path = './高速公路交通流数据/32.31.250.103/20240501_20240501125647_20240501140806_125649.mp4'
duration = calculate_duration('12:56:47', '14:08:05')
total_frames, fps, frame_time, interval_time = get_video_info(video_path, duration)

5. 加载YOLO模型

我们将加载预训练的YOLOv8模型以进行目标检测:

model = YOLO('yolov8n.pt')

这一步确保我们有一个强大的目标检测模型,可以处理视频中的车辆检测。

6. 处理视频帧

我们将处理视频的前10%帧,以减少计算量并专注于关键时刻。以下是相关代码:

num_frames_to_process = total_frames // 1
frame_count = 0# 存储车辆信息
vehicle_data = {}
unique_vehicle_counter = 0
data = []

6.1 定义参数

我们还需要定义一些判断参数,以帮助后续判断车辆是否为同一辆车:

IOU_THRESHOLD = 0.3
MAX_MOVEMENT_DISTANCE = 50
MAX_SIZE_DIFFERENCE = 0.2
COLOR_THRESHOLD = 30
  • IOU_THRESHOLD:用于判断车辆边界框重叠的阈值。
  • MAX_MOVEMENT_DISTANCE:判断车辆在相邻帧之间的最大移动距离。
  • MAX_SIZE_DIFFERENCE:判断车辆大小差异的最大阈值。
  • COLOR_THRESHOLD:用于判断颜色差异的阈值。

7. 定义辅助函数

7.1 计算IoU(交并比)

def calculate_iou(box1, box2):x1, y1, x2, y2 = box1x1b, y1b, x2b, y2b = box2inter_x1 = max(x1, x1b)inter_y1 = max(y1, y1b)inter_x2 = min(x2, x2b)inter_y2 = min(y2, y2b)inter_area = max(0, inter_x2 - inter_x1) * max(0, inter_y2 - inter_y1)box1_area = (x2 - x1) * (y2 - y1)box2_area = (x2b - x1b) * (y2b - y1b)union_area = box1_area + box2_area - inter_areareturn inter_area / union_area if union_area > 0 else 0

此函数计算两个边界框的交并比(IoU),用于判断两个检测框的重叠程度。

7.2 计算中心距离

def calculate_center_distance(box1, box2):center1 = ((box1[0] + box1[2]) / 2, (box1[1] + box1[3]) / 2)center2 = ((box2[0] + box2[2]) / 2, (box2[1] + box2[3]) / 2)return distance.euclidean(center1, center2)

计算两个边界框中心点之间的距离,以判断车辆是否为同一辆车。

7.3 提取车辆颜色

def extract_vehicle_color(frame, box):x1, y1, x2, y2 = map(int, box)vehicle_roi = frame[y1:y2, x1:x2]hsv_roi = cv2.cvtColor(vehicle_roi, cv2.COLOR_BGR2HSV)return cv2.mean(hsv_roi)[:3]

提取车辆在当前帧中的颜色,便于后续判断车辆是否相同。

7.4 计算颜色差异

def calculate_color_difference(color1, color2):return np.linalg.norm(np.array(color1) - np.array(color2))

计算两个颜色之间的差异,为车辆匹配提供依据。

7.5 判断是否为同一辆车

def is_same_vehicle(vehicle_info, new_box, new_color):prev_box = vehicle_info["box"]prev_color = vehicle_info["color"]iou = calculate_iou(prev_box, new_box)center_distance = calculate_center_distance(prev_box, new_box)prev_size = (prev_box[2] - prev_box[0]) * (prev_box[3] - prev_box[1])new_size = (new_box[2] - new_box[0]) * (new_box[3] - new_box[1])size_difference = abs(new_size - prev_size) / prev_size if prev_size > 0 else 1color_difference = calculate_color_difference(prev_color, new_color)return (iou > IOU_THRESHOLDand center_distance < MAX_MOVEMENT_DISTANCEand size_difference < MAX_SIZE_DIFFERENCEand color_difference < COLOR_THRESHOLD)

这个函数综合考虑了IoU、中心距离、大小差异和颜色差异,来判断检测到的车辆是否与之前记录的车辆相同。

7.6 车型类别映射

class_map = {2: 'car',7: 'truck',5: 'bus',3: 'motorcycle',1: 'bicycle',
}

我们定义了一个字典,用于将YOLO模型输出的类别编号映射到相应的车辆类型。

8. 处理视频帧

我们开始逐帧处理视频,检测车辆并记录相关信息:

cap = cv2.VideoCapture(video_path)start_time_seconds = 12 * 3600 + 56 * 60 + 47  # 起始时间转换为秒
frame_count = 0
LANE_WIDTH = 3  # 车道宽度(米)
LANE_LENGTH = 30  # 识别范围的长度(米)# 用于存储流量计算的车辆ID
unique_vehicles_in_interval = set()while cap.isOpened() and frame_count < num_frames_to_process:ret, frame = cap.read()if not ret:breakresults = model(frame)current_frame_vehicle_ids = []vehicle_speeds = []truck_count = 0other_count = 0# 处理检测结果for result in results:for box in result.boxes:coords = box.xyxy[0]x1, y1, x2, y2 = coords[0], coords[1], coords[2], coords[3]cv2.rectangle(frame, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)vehicle_class = int(box.cls.item())vehicle_type = class_map.get(vehicle_class, 'unknown')if vehicle_type == 'truck':truck_count += 1else:other_count += 1vehicle_color = extract_vehicle_color(frame, (x1, y1, x2, y2))matched_vehicle_id = Nonefor vehicle_id, vehicle_info in vehicle_data.items():if is_same_vehicle(vehicle_info, (x1, y1, x2, y2), vehicle_color):matched_vehicle_id = vehicle_idbreakif matched_vehicle_id is None:unique_vehicle_counter += 1matched_vehicle_id = unique_vehicle_countervehicle_data[matched_vehicle_id] = {"box": (x1, y1, x2, y2),"color": vehicle_color,"first_frame": frame_count,"last_frame": frame_count}else:vehicle_data[matched_vehicle_id]["last_frame"] = frame_countvehicle_data[matched_vehicle_id]["box"] = (x1, y1, x2, y2)vehicle_data[matched_vehicle_id]["color"] = vehicle_colorcurrent_frame_vehicle_ids.append(matched_vehicle_id)

在这段代码中,我们使用YOLO模型检测当前帧中的车辆,并提取每辆车的边界框、类型和颜色。通过判断条件,我们可以将车辆与已知车辆进行匹配,确保我们能够跟踪同一辆车。

9. 计算车辆速度

根据检测到的车辆信息,我们可以计算车辆的速度。以下是速度计算的代码:

# 计算车辆速度
for vehicle_id in current_frame_vehicle_ids:vehicle_info = vehicle_data[vehicle_id]first_frame = vehicle_info["first_frame"]last_frame = vehicle_info["last_frame"]frame_diff = last_frame - first_frame + 1if frame_diff > 0:vehicle_speed = 30 / (frame_diff * 0.4)  # 计算速度的公式vehicle_speeds.append(vehicle_speed)

根据车辆在视频中的帧差和已知车道长度,计算每辆车的速度。

10. 过滤速度异常值

为了确保计算结果的可靠性,我们对速度进行过滤,去除异常值:

filtered_speeds = []
if vehicle_speeds:lower_bound = 0upper_bound = 40filtered_speeds = [speed for speed in vehicle_speeds if lower_bound <= speed <= upper_bound]

在这里,我们设定了速度的上下限,仅保留在该范围内的速度数据。

11. 计算流量和密度

在每20帧中,我们将计算流量和车辆密度:

unique_vehicles_in_interval.update(current_frame_vehicle_ids)
if (frame_count + 1) % 20 == 0:flow = len(unique_vehicles_in_interval)  # 每20帧的唯一车辆数unique_vehicles_in_interval.clear()  # 清空当前周期的车辆ID
else:flow = None

通过维护一个唯一车辆ID的集合,我们能够计算特定时间间隔内的流量。

12. 输出信息

最后,我们将输出当前帧的分析结果,并将所有数据存储在一个列表中,便于后续分析:

current_time_seconds = start_time_seconds + frame_count * interval_time
current_time = datetime.utcfromtimestamp(current_time_seconds).strftime('%H:%M:%S')# 输出信息
total_vehicles = truck_count + other_count
print(f"当前帧: {frame_count}, 时间: {current_time}, 卡车数: {truck_count}, 其他车辆数: {other_count}, 总车辆数: {total_vehicles}")
print(f"车辆编号集合: {current_frame_vehicle_ids}")
print(f"原始车辆速度: {vehicle_speeds}")
print(f"过滤后的车辆速度: {filtered_speeds}")
print(f"每帧平均速度: {average_speed:.2f}")
print(f"流量: {flow}辆 " if flow is not None and density is not None else "")
print(f"密度: {density:.2f}辆/米")
# 存储帧相关数据
data.append({'timestamp': current_time,                   'frame': frame_count,'total_vehicles': total_vehicles,'trucks': truck_count,'others': other_count,'vehicle_ids': current_frame_vehicle_ids,  'original_speeds': vehicle_speeds,          'filtered_speeds': filtered_speeds,          'average_speed': average_speed,              'flow': flow,                                'density': density                            
})

13. 显示结果

最后,我们将每帧的结果显示出来,并在按下’q’键时退出视频:

cv2.imshow('frame', frame)
frame_count += 1
if cv2.waitKey(1) & 0xFF == ord('q'):break

14. 保存结果

完成视频处理后,我们将分析结果转换为DataFrame,并保存到Excel文件中,以便后续分析:

df = pd.DataFrame(data)
df.to_excel('./video_analysis_with_color.xlsx', index=False)

输出表格展示:

在这里插入图片描述

15. 总结

通过上述步骤,我们实现了一个基于YOLO模型的高速公路交通流量分析系统。该系统不仅可以检测和跟踪车辆,还能计算它们的速度、流量和密度,为交通管理提供重要的数据支持。随着技术的不断进步,我们期待在交通流量监测方面能够实现更高的自动化和智能化。

完整代码

import cv2
import pandas as pd
import numpy as np
from ultralytics import YOLO
from datetime import datetime
from scipy.spatial import distance# 计算视频时长
def calculate_duration(start_time, end_time):fmt = '%H:%M:%S'start = datetime.strptime(start_time, fmt)end = datetime.strptime(end_time, fmt)duration = end - startreturn duration# 获取视频信息
def get_video_info(video_path, duration):cap = cv2.VideoCapture(video_path)if not cap.isOpened():raise ValueError("无法打开视频文件")total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))fps = cap.get(cv2.CAP_PROP_FPS)frame_time = 1 / fps if fps > 0 else 0interval_time = duration.total_seconds() / total_frames if total_frames > 0 else 0cap.release()return total_frames, fps, frame_time, interval_time# 初始化路径和视频时长
video_path = './高速公路交通流数据/32.31.250.103/20240501_20240501125647_20240501140806_125649.mp4'
duration = calculate_duration('12:56:47', '14:08:05')
total_frames, fps, frame_time, interval_time = get_video_info(video_path, duration)# 加载预训练的YOLOv8模型
model = YOLO('yolov8n.pt')# 处理前10%的帧
num_frames_to_process = total_frames // 100
frame_count = 0# 存储车辆信息
vehicle_data = {}
unique_vehicle_counter = 0
data = []# 定义IoU阈值以及其他判断参数
IOU_THRESHOLD = 0.3
MAX_MOVEMENT_DISTANCE = 50
MAX_SIZE_DIFFERENCE = 0.2
COLOR_THRESHOLD = 30# 计算IoU(交并比)
def calculate_iou(box1, box2):x1, y1, x2, y2 = box1x1b, y1b, x2b, y2b = box2inter_x1 = max(x1, x1b)inter_y1 = max(y1, y1b)inter_x2 = min(x2, x2b)inter_y2 = min(y2, y2b)inter_area = max(0, inter_x2 - inter_x1) * max(0, inter_y2 - inter_y1)box1_area = (x2 - x1) * (y2 - y1)box2_area = (x2b - x1b) * (y2b - y1b)union_area = box1_area + box2_area - inter_areareturn inter_area / union_area if union_area > 0 else 0# 计算中心距离
def calculate_center_distance(box1, box2):center1 = ((box1[0] + box1[2]) / 2, (box1[1] + box1[3]) / 2)center2 = ((box2[0] + box2[2]) / 2, (box2[1] + box2[3]) / 2)return distance.euclidean(center1, center2)# 提取车辆颜色
def extract_vehicle_color(frame, box):x1, y1, x2, y2 = map(int, box)vehicle_roi = frame[y1:y2, x1:x2]hsv_roi = cv2.cvtColor(vehicle_roi, cv2.COLOR_BGR2HSV)return cv2.mean(hsv_roi)[:3]# 计算颜色差异
def calculate_color_difference(color1, color2):return np.linalg.norm(np.array(color1) - np.array(color2))# 判断车辆是否为同一辆车
def is_same_vehicle(vehicle_info, new_box, new_color):prev_box = vehicle_info["box"]prev_color = vehicle_info["color"]iou = calculate_iou(prev_box, new_box)center_distance = calculate_center_distance(prev_box, new_box)prev_size = (prev_box[2] - prev_box[0]) * (prev_box[3] - prev_box[1])new_size = (new_box[2] - new_box[0]) * (new_box[3] - new_box[1])size_difference = abs(new_size - prev_size) / prev_size if prev_size > 0 else 1color_difference = calculate_color_difference(prev_color, new_color)return (iou > IOU_THRESHOLDand center_distance < MAX_MOVEMENT_DISTANCEand size_difference < MAX_SIZE_DIFFERENCEand color_difference < COLOR_THRESHOLD)# 车型类别映射
class_map = {2: 'car',7: 'truck',5: 'bus',3: 'motorcycle',1: 'bicycle',
}# 打开视频文件
cap = cv2.VideoCapture(video_path)start_time_seconds = 12 * 3600 + 56 * 60 + 47  # 起始时间转换为秒
frame_count = 0
LANE_WIDTH = 3  # 车道宽度(米)
LANE_LENGTH = 30  # 识别范围的长度(米)# 用于存储流量计算的车辆ID
unique_vehicles_in_interval = set()while cap.isOpened() and frame_count < num_frames_to_process:ret, frame = cap.read()if not ret:breakresults = model(frame)current_frame_vehicle_ids = []vehicle_speeds = []truck_count = 0other_count = 0# 处理检测结果for result in results:for box in result.boxes:coords = box.xyxy[0]x1, y1, x2, y2 = coords[0], coords[1], coords[2], coords[3]cv2.rectangle(frame, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)vehicle_class = int(box.cls.item())vehicle_type = class_map.get(vehicle_class, 'unknown')if vehicle_type == 'truck':truck_count += 1else:other_count += 1vehicle_color = extract_vehicle_color(frame, (x1, y1, x2, y2))matched_vehicle_id = Nonefor vehicle_id, vehicle_info in vehicle_data.items():if is_same_vehicle(vehicle_info, (x1, y1, x2, y2), vehicle_color):matched_vehicle_id = vehicle_idbreakif matched_vehicle_id is None:unique_vehicle_counter += 1matched_vehicle_id = unique_vehicle_countervehicle_data[matched_vehicle_id] = {"box": (x1, y1, x2, y2),"color": vehicle_color,"first_frame": frame_count,"last_frame": frame_count}else:vehicle_data[matched_vehicle_id]["last_frame"] = frame_countvehicle_data[matched_vehicle_id]["box"] = (x1, y1, x2, y2)vehicle_data[matched_vehicle_id]["color"] = vehicle_colorcurrent_frame_vehicle_ids.append(matched_vehicle_id)# 计算车辆速度for vehicle_id in current_frame_vehicle_ids:vehicle_info = vehicle_data[vehicle_id]first_frame = vehicle_info["first_frame"]last_frame = vehicle_info["last_frame"]frame_diff = last_frame - first_frame + 1if frame_diff > 0:vehicle_speed = 30 / (frame_diff * 0.4)  # 计算速度的公式vehicle_speeds.append(vehicle_speed)# 过滤速度异常值filtered_speeds = []if vehicle_speeds:lower_bound = 0upper_bound = 40filtered_speeds = [speed for speed in vehicle_speeds if lower_bound <= speed <= upper_bound]# 计算每一帧的平均速度average_speed = np.mean(filtered_speeds) if filtered_speeds else 0# 计算流量和密度unique_vehicles_in_interval.update(current_frame_vehicle_ids)if (frame_count + 1) % 20 == 0:flow = len(unique_vehicles_in_interval)  # 每20帧的唯一车辆数unique_vehicles_in_interval.clear()  # 清空当前周期的车辆IDelse:flow = None# 计算实际时间current_time_seconds = start_time_seconds + frame_count * interval_timecurrent_time = datetime.utcfromtimestamp(current_time_seconds).strftime('%H:%M:%S')# 输出信息total_vehicles = truck_count + other_countdensity = total_vehicles / (LANE_WIDTH * LANE_LENGTH)  # 单位长度内的车辆数print(f"当前帧: {frame_count}, 时间: {current_time}, 卡车数: {truck_count}, 其他车辆数: {other_count}, 总车辆数: {total_vehicles}")print(f"车辆编号集合: {current_frame_vehicle_ids}")print(f"原始车辆速度: {vehicle_speeds}")print(f"过滤后的车辆速度: {filtered_speeds}")print(f"每帧平均速度: {average_speed:.2f}")print(f"流量: {flow}辆 " if flow is not None and density is not None else "")print(f"密度: {density:.2f}辆/米")# 存储帧相关数据data.append({'timestamp': current_time,                   # 当前帧的时间戳'frame': frame_count,'total_vehicles': total_vehicles,'trucks': truck_count,'others': other_count,'vehicle_ids': current_frame_vehicle_ids,  # 记录当前帧车辆编号'original_speeds': vehicle_speeds,          # 原始速度'filtered_speeds': filtered_speeds,          # 过滤后的速度'average_speed': average_speed,              # 每帧平均速度'flow': flow,                                # 流量'density': density                            # 密度})# 显示结果cv2.imshow('frame', frame)# 更新帧计数器frame_count += 1if cv2.waitKey(1) & 0xFF == ord('q'):break
cap.release()
cv2.destroyAllWindows()# 转换为DataFrame并保存到Excel
df = pd.DataFrame(data)
df.to_excel('./video_analysis_with_color.xlsx', index=False)

再次提醒:本文内容仅供参考,作者对此不负任何责任。希望读者能够从中获得启发,继续探索交通流量分析的更深入领域。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1542687.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

资源创建方式-Job

Job: 容器按照持续运行的时间可分为两类&#xff0c;服务类容器&#xff0c;和工作类容器 服务类容器通常持续提供服务&#xff0c;需要一直运行&#xff0c;比如HTTP,Server&#xff0c;Daemon等&#xff0c; 工作类容器则是一次性任务&#xff0c;比如批处理程序&#xff0…

stm32单片机个人学习笔记7(TIM定时中断)

前言 本篇文章属于stm32单片机&#xff08;以下简称单片机&#xff09;的学习笔记&#xff0c;来源于B站教学视频。下面是这位up主的视频链接。本文为个人学习笔记&#xff0c;只能做参考&#xff0c;细节方面建议观看视频&#xff0c;肯定受益匪浅。 STM32入门教程-2023版 细…

数值计算 --- 平方根倒数快速算法(中)

平方根倒数快速算法 --- 向Greg Walsh致敬&#xff01; 1&#xff0c;平方根倒数快速算法是如何选择初值的?WTF中的神秘数字究竟是怎么来的&#xff1f; 花开两朵&#xff0c;各表一枝。在前面的介绍中&#xff0c;我们已经知道了这段代码的作者在函数的最后使用了NR-iteratio…

Python办公自动化教程(003):PDF的加密

【1】代码 from PyPDF2 import PdfReader, PdfWriter# 读取PDF文件 pdf_reader PdfReader(./file/Python教程_1.pdf) pdf_writer PdfWriter()# 对第1页进行加密 page pdf_reader.pages[0]pdf_writer.add_page(page) # 设置密码 pdf_writer.encrypt(3535)with open(./file/P…

mybatis 配置文件完成增删改查(四) :多条件 动态sql查询

文章目录 就是你在接收数据时&#xff0c;有的查询条件不写&#xff0c;也能从查到相应的stauts也可能为空恒等式标签 代替where关键字 就是你在接收数据时&#xff0c;有的查询条件不写&#xff0c;也能从查到相应的 注意是写字段名 还是 属性名 companyName不写也能查出满足…

亚马逊IP关联揭秘:发生ip关联如何处理

在亚马逊这一全球领先的电商平台上&#xff0c;IP关联是一个不可忽视的问题&#xff0c;尤其是对于多账号运营的卖家而言。本文将深入解析亚马逊IP关联的含义、影响以及应对策略&#xff0c;帮助卖家更好地理解和应对这一问题。 什么是亚马逊IP关联&#xff1f; 亚马逊IP关联…

9.22算法题数组篇

数组的遍历 485.最大连续1的个数 题解 class Solution {public int findMaxConsecutiveOnes(int[] nums) {int maxcount0,count0;for (int i 0;i<nums.length;i){if(nums[i]1){count;}else{maxcountMath.max(maxcount,count);count0;}}maxcountMath.max(maxcount,count);r…

2024AI做PPT软件如何重塑演示文稿的创作

现在AI技术的发展已经可以帮我们写作、绘画&#xff0c;最近我发现了不少ai做ppt的工具&#xff01;不体验不知道&#xff0c;原来合理使用AI工具可以有效的帮我们进行一些办公文件的编写&#xff0c;提高了不少工作效率。如果你也有这方面的需求就接着往下看吧。 1.笔灵AIPPT…

linux-----进程控制

提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、fork()函数 返回值&#xff1a;子进程返回0&#xff0c;父进程返回子进程的id,出错就返回-1. fork创建子进程&#xff0c;如果父子一方发生写入时&#xff0c;就会发生写实拷贝&#xff0c;操作系统就…

【AD24报错】PCB调整线宽后提示 Width Constraint: Track ### on Top Layer的解决方案

【AD24报错】PCB调整线宽提示Width Constraint: Track&#xff08;##mil, ##mil&#xff09;&#xff08;##mil, ##mil&#xff09;on Top Layer的解决方案 一、Width Constraint问题复现二、有关于Width Constraint的解决方案三、可能导致 Width Constraint 报错的其他因素&am…

C++初阶:STL详解(六)——list的介绍和使用

✨✨小新课堂开课了&#xff0c;欢迎欢迎~✨✨ &#x1f388;&#x1f388;养成好习惯&#xff0c;先赞后看哦~&#x1f388;&#x1f388; 所属专栏&#xff1a;C&#xff1a;由浅入深篇 小新的主页&#xff1a;编程版小新-CSDN博客 前言&#xff1a; 前面我们已经了解了strin…

c++----io流

提示&#xff1a;以下 是本篇文章正文内容&#xff0c;下面案例可供参考 1.标准io流 (1)数据的循环输入 对于内置类型&#xff1a;cin和cout直接使用&#xff0c;c已经重载了 (2)对于自定义类型&#xff1a; 需要我们自己对类型进行重载 2.文件io流 ifstream ifile(只输入…

机器学习中结构风险最小化的正则化项用途及原理详解

一、概述 数学和工程领域&#xff0c;正则(Regularize)意味着使某物标准化或规范化&#xff0c;在机器学习领域指的是使模型的行为更加规范化&#xff0c;以避免极端或过于复杂的模型。 正则化项&#xff08;Regularization Term&#xff09;是机器学习模型中用于控制模型复杂…

力扣72-编辑距离(Java详细题解)

题目链接&#xff1a;力扣72-编辑距离 前情提要&#xff1a; 因为本人最近都来刷dp类的题目所以该题就默认用dp方法来做。 dp五部曲。 1.确定dp数组和i下标的含义。 2.确定递推公式。 3.dp初始化。 4.确定dp的遍历顺序。 5.如果没有ac打印dp数组 利于debug。 每一个dp…

鸿蒙OpenHarmony【轻量系统内核扩展组件(动态加载)】子系统开发

基本概念 在硬件资源有限的小设备中&#xff0c;需要通过算法的动态部署能力来解决无法同时部署多种算法的问题。以开发者易用为主要考虑因素&#xff0c;同时考虑到多平台的通用性&#xff0c;LiteOS-M选择业界标准的ELF加载方案&#xff0c;方便拓展算法生态。LiteOS-M提供类…

微信小程序认证流程

官方描述&#xff1a; 微信接口服务&#xff1a;即微信服务器。 具体的流程如下&#xff1a; 1.前端调用wx.login()获取登录凭证code 2.前端请求后端进行认证&#xff0c;发送code 3.后端请求微信获取openid 4.后端生成认证成功凭证返回给前端。 说明 调用 wx.login() 获…

【二等奖论文】2024年华为杯研赛C题54页成品论文(后续会更新)

您的点赞收藏是我继续更新的最大动力&#xff01; 一定要点击如下的卡片&#xff0c;那是获取论文的入口&#xff01; 点击链接获取【2024华为杯研赛资料汇总】&#xff1a;https://qm.qq.com/q/Nr0POlQGc2https://qm.qq.com/q/Nr0POlQGc2 摘 要&#xff1a; 随着国民经济发…

简易CPU设计入门:取指令(一),端口列表与变量声明

取指令这一块呢&#xff0c;个人觉得&#xff0c;不太好讲。但是呢&#xff0c;不好讲&#xff0c;我也得讲啊。那就尽量地讲吧。如果讲得不好的话&#xff0c;那么&#xff0c;欢迎大家提出好的意见&#xff0c;帮助我改进讲课的质量。 首先呢&#xff0c;还是请大家去下载本…

nodejs基于vue电子产品商城销售网站的设计与实现 _bugfu

目录 技术栈具体实现截图系统设计思路技术可行性nodejs类核心代码部分展示可行性论证研究方法解决的思路Express框架介绍源码获取/联系我 技术栈 该系统将采用B/S结构模式&#xff0c;开发软件有很多种可以用&#xff0c;本次开发用到的软件是vscode&#xff0c;用到的数据库是…

FiBiNET模型实现推荐算法

1. 项目简介 A031-FiBiNET模型项目是一个基于深度学习的推荐系统算法实现&#xff0c;旨在提升推荐系统的性能和精度。该项目的背景源于当今互联网平台中&#xff0c;推荐算法在电商、社交、内容分发等领域的广泛应用。推荐系统通过分析用户的历史行为和兴趣偏好&#xff0c;预…