当前位置: 首页 > article >正文

USB设备端口识别监测嵌入式python3自动化测试脚本

软件版本python3编译器IDLE编译器库PyAutoGUl库cmd终端安装PyAutoGUl库命令pip install pyautogui一、应用场景简介嵌入式设备测试开发中开关机测试监控特定USB设备的连接状态变化记录USB端口连接断开次数其它。——多设备测试生产线测试自动化测试二、功能简介监测电脑设备管理器的端口的连接开机和断开关机记录连接和断开的次数。三、脚本GUI界面功能介绍使用配置好VOD,PID后下方第3点描述VID,PID查看方式点击开始监测停止监测。1.注使用前查看设备端口是否被正常识别端口是否可用。Ctrlx选择设备管理器查看CMO端口。2.日志保存路径D\0\test_log不清空之前的日志会保留之前的日志。监控设备配置功能板块可自行配置VID,PID下方第3点描述VID,PID查看方式输入后点击应用配置。设备状态功能板块显示端口名连接时长。本次监控统计功能板块记录连接次数断开次数监控状态设备连接断开状态检查频率为1s事件日志功能板块显示最新的设备连接断开信息。最底部为监控使用的按钮开始监控停止监控重置统计数量等。3.查看VIDPID快捷键ctalx设备管理器端口右键属性事件。代码如下。关注点赞欢迎留言评论区。备注日志一直在一个文档不删除历史日志一直累计有需可改import tkinter as tkfrom tkinter import ttkimport threadingimport timeimport sysimport osfrom datetime import datetimeimport jsontry:import serial.tools.list_portsimport serialSERIAL_AVAILABLE Trueexcept ImportError:SERIAL_AVAILABLE Falseprint(请先安装pyserial模块: pip install pyserial)# 目标设备的VID和PIDTARGET_VID 05C6TARGET_PID 902E# 日志保存路径LOG_DIR rD:\0\test_logLOG_FILE os.path.join(LOG_DIR, usb_monitor_log.txt)STATS_FILE os.path.join(LOG_DIR, usb_statistics.json)DAILY_LOG_DIR os.path.join(LOG_DIR, daily_logs)class USBMonitorApp:def __init__(self, root):self.root rootself.root.title(USB设备监控器 - 带日志保存)self.root.geometry(650x500)# 状态变量self.device_connected Falseself.monitoring_active Falseself.monitor_thread None# 本次监控统计从开始监控时清零self.session_connection_count 0 # 本次监控连接次数self.session_disconnection_count 0 # 本次监控断开次数self.session_start_time None # 本次监控开始时间self.session_running_time 0 # 本次监控运行时间秒# 设备连接时间记录self.device_connect_time Noneself.device_disconnect_time None# 日志列表self.log_entries []# 创建日志目录self.setup_log_directory()self.setup_ui()# 检查依赖if not SERIAL_AVAILABLE:self.show_error(请先安装pyserial模块:\n打开CMD并运行: pip install pyserial)return# 记录程序启动self.log_program_start()# 默认自动开始监控self.start_monitoring()def setup_log_directory(self):创建日志目录try:os.makedirs(LOG_DIR, exist_okTrue)os.makedirs(DAILY_LOG_DIR, exist_okTrue)print(f日志目录已创建: {LOG_DIR})except Exception as e:print(f创建日志目录失败: {e})def setup_ui(self):# 创建主框架main_frame ttk.Frame(self.root, padding10)main_frame.grid(row0, column0, sticky(tk.W, tk.E, tk.N, tk.S))# 标题和路径显示title_frame ttk.Frame(main_frame)title_frame.grid(row0, column0, columnspan3, pady(0, 10), sticky(tk.W, tk.E))title_label ttk.Label(title_frame, textUSB设备监控系统, font(Arial, 16, bold))title_label.grid(row0, column0, stickytk.W)# 显示日志路径log_path_label ttk.Label(title_frame, textf日志路径: {LOG_DIR}, font(Arial, 8), foregroundgray)log_path_label.grid(row1, column0, stickytk.W, pady(2, 0))# 设备信息info_frame ttk.LabelFrame(main_frame, text监控设备信息, padding10)info_frame.grid(row1, column0, columnspan3, sticky(tk.W, tk.E), pady(0, 10))ttk.Label(info_frame, textVID:).grid(row0, column0, stickytk.W)ttk.Label(info_frame, textTARGET_VID, font(Arial, 10, bold), foregroundblue).grid(row0, column1, stickytk.W, padx(5, 20))ttk.Label(info_frame, textPID:).grid(row0, column2, stickytk.W)ttk.Label(info_frame, textTARGET_PID, font(Arial, 10, bold), foregroundblue).grid(row0, column3, stickytk.W, padx(5, 0))# 状态显示status_frame ttk.LabelFrame(main_frame, text设备状态, padding10)status_frame.grid(row2, column0, columnspan3, sticky(tk.W, tk.E), pady(0, 10))self.status_label ttk.Label(status_frame, text正在检测..., font(Arial, 12))self.status_label.grid(row0, column0, stickytk.W, padx(10, 20))self.status_indicator tk.Canvas(status_frame, width20, height20, bggray)self.status_indicator.grid(row0, column1, stickytk.W)# 当前连接时长显示self.connection_duration_label ttk.Label(status_frame, text连接时长: --:--:--, font(Arial, 9))self.connection_duration_label.grid(row0, column2, stickytk.W, padx(30, 0))# 连接统计本次监控count_frame ttk.LabelFrame(main_frame, text本次监控统计, padding10)count_frame.grid(row3, column0, columnspan3, sticky(tk.W, tk.E), pady(0, 10))# 连接次数ttk.Label(count_frame, text连接次数:).grid(row0, column0, stickytk.W)self.connection_label ttk.Label(count_frame, text0, font(Arial, 12, bold), foregroundgreen)self.connection_label.grid(row0, column1, stickytk.W, padx(5, 30))# 断开次数ttk.Label(count_frame, text断开次数:).grid(row0, column2, stickytk.W)self.disconnection_label ttk.Label(count_frame, text0, font(Arial, 12, bold), foregroundred)self.disconnection_label.grid(row0, column3, stickytk.W, padx(5, 0))# 运行时间ttk.Label(count_frame, text运行时间:).grid(row0, column4, stickytk.W, padx(20, 5))self.runtime_label ttk.Label(count_frame, text00:00:00, font(Arial, 10, bold))self.runtime_label.grid(row0, column5, stickytk.W)# 监控状态ttk.Label(count_frame, text监控状态:).grid(row1, column0, stickytk.W, pady(5, 0))self.monitoring_status_label ttk.Label(count_frame, text未开始, font(Arial, 10, bold))self.monitoring_status_label.grid(row1, column1, stickytk.W, padx(5, 30), pady(5, 0))# 当前状态ttk.Label(count_frame, text设备状态:).grid(row1, column2, stickytk.W, pady(5, 0))self.device_status_label ttk.Label(count_frame, text未知, font(Arial, 10, bold))self.device_status_label.grid(row1, column3, stickytk.W, padx(5, 0), pady(5, 0))# 检查频率ttk.Label(count_frame, text检查频率:).grid(row1, column4, stickytk.W, padx(20, 5), pady(5, 0))self.check_freq_label ttk.Label(count_frame, text1秒, font(Arial, 10, bold))self.check_freq_label.grid(row1, column5, stickytk.W, pady(5, 0))# 日志区域log_frame ttk.LabelFrame(main_frame, text事件日志, padding10)log_frame.grid(row4, column0, columnspan3, sticky(tk.W, tk.E, tk.N, tk.S), pady(0, 10))# 创建日志框架self.log_frame_inner ttk.Frame(log_frame)self.log_frame_inner.pack(filltk.BOTH, expandTrue)# 创建滚动条scrollbar ttk.Scrollbar(self.log_frame_inner)scrollbar.pack(sidetk.RIGHT, filltk.Y)# 创建日志文本框self.log_text tk.Text(self.log_frame_inner,height10,width70,yscrollcommandscrollbar.set,bg#f5f5f5,relieftk.FLAT,font(Consolas, 9))self.log_text.pack(sidetk.LEFT, filltk.BOTH, expandTrue)scrollbar.config(commandself.log_text.yview)# 控制按钮button_frame ttk.Frame(main_frame)button_frame.grid(row5, column0, columnspan3, pady(10, 0))self.start_button ttk.Button(button_frame, text▶ 开始监控, commandself.start_monitoring)self.start_button.grid(row0, column0, padx(0, 10))self.stop_button ttk.Button(button_frame, text■ 停止监控, commandself.stop_monitoring, statedisabled)self.stop_button.grid(row0, column1, padx(0, 10))self.reset_button ttk.Button(button_frame, text 重置统计, commandself.reset_statistics)self.reset_button.grid(row0, column2, padx(0, 10))self.clear_button ttk.Button(button_frame, text️ 清空日志, commandself.clear_log)self.clear_button.grid(row0, column3, padx(0, 10))self.copy_button ttk.Button(button_frame, text 复制日志, commandself.copy_log)self.copy_button.grid(row0, column4, padx(0, 10))self.save_button ttk.Button(button_frame, text 保存日志, commandself.save_log)self.save_button.grid(row0, column5, padx(0, 10))self.view_button ttk.Button(button_frame, text 打开日志, commandself.open_log_folder)self.view_button.grid(row0, column6, padx(0, 10))self.quit_button ttk.Button(button_frame, text✕ 退出, commandself.quit_app)self.quit_button.grid(row0, column7)# 配置网格权重self.root.columnconfigure(0, weight1)self.root.rowconfigure(0, weight1)main_frame.columnconfigure(0, weight1)main_frame.rowconfigure(4, weight1)# 初始化运行时间更新self.update_runtime()self.update_connection_duration()def update_runtime(self):更新运行时间if self.monitoring_active and self.session_start_time:elapsed int(time.time() - self.session_start_time)self.session_running_time elapsedhours elapsed // 3600minutes (elapsed % 3600) // 60seconds elapsed % 60self.runtime_label.config(textf{hours:02d}:{minutes:02d}:{seconds:02d})# 每秒更新一次self.root.after(1000, self.update_runtime)def update_connection_duration(self):更新连接时长if self.device_connected and self.device_connect_time:elapsed int(time.time() - self.device_connect_time)hours elapsed // 3600minutes (elapsed % 3600) // 60seconds elapsed % 60self.connection_duration_label.config(textf连接时长: {hours:02d}:{minutes:02d}:{seconds:02d})else:self.connection_duration_label.config(text连接时长: --:--:--)# 每秒更新一次self.root.after(1000, self.update_connection_duration)def check_device(self):检查目标设备是否连接try:ports serial.tools.list_ports.comports()for port in ports:if hasattr(port, vid) and port.vid:vid_hex f{port.vid:04X}.upper()pid_hex f{port.pid:04X}.upper() if port.pid else 0000if vid_hex TARGET_VID and pid_hex TARGET_PID:return True, port.device, port.descriptionreturn False, None, Noneexcept Exception as e:self.log_event(f检查设备时出错: {str(e)}, error)return False, None, Nonedef update_status(self, connected, port_infoNone, descriptionNone):更新UI状态current_status connected if connected else disconnectedif connected and not self.device_connected:# 设备刚刚连接self.session_connection_count 1self.device_connected Trueself.device_connect_time time.time()# 更新UIself.status_label.config(textf已连接 - {port_info})self.status_indicator.config(bggreen)self.connection_label.config(textstr(self.session_connection_count))self.device_status_label.config(text已连接, foregroundgreen)# 保存到文件timestamp datetime.now().strftime(%Y-%m-%d %H:%M:%S)log_entry f[{timestamp}] 设备连接 - 端口: {port_info}, 描述: {description}self.log_event(f[{timestamp}] ✓ 设备已连接 - 端口: {port_info}, 描述: {description}, connect)self.save_to_log_file(log_entry, CONNECT)# 播放连接提示音self.root.bell()elif not connected and self.device_connected:# 设备刚刚断开self.session_disconnection_count 1self.device_connected False# 计算连接时长duration if self.device_connect_time:connect_duration int(time.time() - self.device_connect_time)hours connect_duration // 3600minutes (connect_duration % 3600) // 60seconds connect_duration % 60duration f (连接时长: {hours:02d}:{minutes:02d}:{seconds:02d})self.device_connect_time None# 更新UIself.status_label.config(text未连接)self.status_indicator.config(bgred)self.disconnection_label.config(textstr(self.session_disconnection_count))self.device_status_label.config(text未连接, foregroundred)# 保存到文件timestamp datetime.now().strftime(%Y-%m-%d %H:%M:%S)log_entry f[{timestamp}] 设备断开{duration}self.log_event(f[{timestamp}] ✗ 设备已断开{duration}, disconnect)self.save_to_log_file(log_entry, DISCONNECT)# 播放断开提示音self.root.bell()elif connected and self.device_connected:# 设备保持连接状态self.status_label.config(textf已连接 - {port_info})self.status_indicator.config(bggreen)self.device_status_label.config(text已连接, foregroundgreen)else:# 设备保持断开状态self.status_label.config(text未连接)self.status_indicator.config(bgred)self.device_status_label.config(text未连接, foregroundred)# 保存统计数据self.save_statistics()def reset_statistics(self):重置统计信息if self.monitoring_active:response tk.messagebox.askyesno(确认, 监控正在进行中重置统计将清空当前数据。\n是否继续)if not response:return# 重置统计self.session_connection_count 0self.session_disconnection_count 0self.session_running_time 0# 更新UIself.connection_label.config(text0)self.disconnection_label.config(text0)self.runtime_label.config(text00:00:00)self.status_label.config(text未连接)self.status_indicator.config(bggray)self.device_status_label.config(text未知)self.connection_duration_label.config(text连接时长: --:--:--)# 清空日志self.clear_log()timestamp datetime.now().strftime(%Y-%m-%d %H:%M:%S)self.log_event(f[{timestamp}] 统计信息已重置, info)# 如果是监控中重新开始计时if self.monitoring_active:self.session_start_time time.time()self.log_event(f[{timestamp}] ⏱️ 监控计时已重置, info)def save_to_log_file(self, message, event_type):保存日志到文件try:# 保存到主日志文件with open(LOG_FILE, a, encodingutf-8) as f:f.write(f{message}\n)# 保存到每日日志文件today datetime.now().strftime(%Y%m%d)daily_log_file os.path.join(DAILY_LOG_DIR, fusb_log_{today}.txt)with open(daily_log_file, a, encodingutf-8) as f:f.write(f{message}\n)except Exception as e:self.log_event(f保存日志到文件失败: {str(e)}, error)def save_to_detailed_log(self, data):保存详细日志JSON格式try:detailed_log {timestamp: datetime.now().strftime(%Y-%m-%d %H:%M:%S),event: data.get(event),port: data.get(port),description: data.get(description),duration: data.get(duration),session_connections: self.session_connection_count,session_disconnections: self.session_disconnection_count,session_runtime: self.session_running_time}today datetime.now().strftime(%Y%m%d)detailed_log_file os.path.join(DAILY_LOG_DIR, fdetailed_log_{today}.json)# 读取现有数据或创建新列表if os.path.exists(detailed_log_file):with open(detailed_log_file, r, encodingutf-8) as f:logs json.load(f)else:logs []# 添加新日志logs.append(detailed_log)# 保存回文件with open(detailed_log_file, w, encodingutf-8) as f:json.dump(logs, f, ensure_asciiFalse, indent2)except Exception as e:self.log_event(f保存详细日志失败: {str(e)}, error)def log_event(self, message, event_typeinfo):添加日志条目到UItimestamp datetime.now().strftime(%H:%M:%S)# 为不同事件类型设置不同颜色if event_type connect:tag_color greenelif event_type disconnect:tag_color redelif event_type error:tag_color orangeelse:tag_color black# 插入带时间戳的日志self.log_text.insert(tk.END, message \n)# 为最近的消息设置颜色标签start_index self.log_text.search(message.split(\n)[0], end-1c linestart, stopindex1.0)if start_index:end_index f{start_index}{len(message)}cself.log_text.tag_add(event_type, start_index, end_index)self.log_text.tag_config(event_type, foregroundtag_color)self.log_text.see(tk.END) # 自动滚动到底部# 保存到日志列表self.log_entries.append(message)def load_statistics(self):加载历史统计数据现在只用于读取不影响本次监控统计try:if os.path.exists(STATS_FILE):with open(STATS_FILE, r, encodingutf-8) as f:stats json.load(f)# 只读取不用于显示total_connections stats.get(total_connections, 0)total_disconnections stats.get(total_disconnections, 0)# 记录到日志但不显示在UItimestamp datetime.now().strftime(%H:%M:%S)self.log_event(f[{timestamp}] 历史统计: 总连接 {total_connections} 次, 总断开 {total_disconnections} 次, info)except Exception as e:self.log_event(f读取历史统计失败: {str(e)}, error)def save_statistics(self):保存统计数据try:# 读取现有统计数据if os.path.exists(STATS_FILE):with open(STATS_FILE, r, encodingutf-8) as f:stats json.load(f)else:stats {}# 更新统计数据total_connections stats.get(total_connections, 0) self.session_connection_counttotal_disconnections stats.get(total_disconnections, 0) self.session_disconnection_countstats.update({total_connections: total_connections,total_disconnections: total_disconnections,last_updated: datetime.now().strftime(%Y-%m-%d %H:%M:%S),last_session_connections: self.session_connection_count,last_session_disconnections: self.session_disconnection_count,last_session_runtime: self.session_running_time})with open(STATS_FILE, w, encodingutf-8) as f:json.dump(stats, f, ensure_asciiFalse, indent2)except Exception as e:self.log_event(f保存统计数据失败: {str(e)}, error)def log_program_start(self):记录程序启动try:start_time datetime.now().strftime(%Y-%m-%d %H:%M:%S)log_entry f[{start_time}] 程序启动 # 保存到日志文件with open(LOG_FILE, a, encodingutf-8) as f:f.write(f\n{log_entry}\n)# 在UI中显示self.log_event(f[{datetime.now().strftime(%H:%M:%S)}] ✅ 程序启动 - 日志保存到: {LOG_DIR}, info)# 加载历史统计仅显示self.load_statistics()except Exception as e:self.log_event(f记录程序启动失败: {str(e)}, error)def clear_log(self):清空日志self.log_text.delete(1.0, tk.END)self.log_entries.clear()self.log_event(f[{datetime.now().strftime(%H:%M:%S)}] 日志已清空, info)def copy_log(self):复制日志到剪贴板try:log_content self.log_text.get(1.0, tk.END).strip()if log_content:self.root.clipboard_clear()self.root.clipboard_append(log_content)self.log_event(f[{datetime.now().strftime(%H:%M:%S)}] 日志已复制到剪贴板, info)except Exception as e:self.log_event(f复制日志时出错: {str(e)}, error)def save_log(self):手动保存日志try:timestamp datetime.now().strftime(%Y%m%d_%H%M%S)manual_log_file os.path.join(LOG_DIR, fmanual_save_{timestamp}.txt)with open(manual_log_file, w, encodingutf-8) as f:f.write(self.log_text.get(1.0, tk.END))self.log_event(f[{datetime.now().strftime(%H:%M:%S)}] 日志已手动保存到: {manual_log_file}, info)except Exception as e:self.log_event(f保存日志失败: {str(e)}, error)def open_log_folder(self):打开日志文件夹try:os.startfile(LOG_DIR)self.log_event(f[{datetime.now().strftime(%H:%M:%S)}] 已打开日志文件夹, info)except Exception as e:self.log_event(f打开日志文件夹失败: {str(e)}, error)def monitor_loop(self):监控循环check_interval 1 # 检查间隔(秒)while self.monitoring_active:try:connected, port, description self.check_device()# 在UI线程中更新状态self.root.after(0, lambda cconnected, pport, ddescription: self.update_status(c, p, d))# 等待下次检查for _ in range(check_interval * 10):if not self.monitoring_active:breaktime.sleep(0.1)except Exception as e:self.root.after(0, lambda: self.log_event(f监控循环错误: {str(e)}, error))time.sleep(check_interval)def start_monitoring(self):开始监控if self.monitoring_active:returnself.monitoring_active Trueself.session_start_time time.time()self.start_button.config(statedisabled)self.stop_button.config(statenormal)self.monitoring_status_label.config(text运行中, foregroundgreen)# 记录监控开始时间self.current_session_start datetime.now()self.save_to_log_file(f[{self.current_session_start.strftime(%Y-%m-%d %H:%M:%S)}] 监控开始, INFO)# 初始检查connected, port, description self.check_device()self.update_status(connected, port, description)# 启动监控线程self.monitor_thread threading.Thread(targetself.monitor_loop, daemonTrue)self.monitor_thread.start()timestamp datetime.now().strftime(%Y-%m-%d %H:%M:%S)self.log_event(f[{timestamp}] ✅ 开始监控设备 VID:{TARGET_VID}, PID:{TARGET_PID}, info)self.log_event(f[{timestamp}] 统计从此刻开始: 连接次数{self.session_connection_count}, 断开次数{self.session_disconnection_count}, 运行时间00:00:00, info)def stop_monitoring(self):停止监控if not self.monitoring_active:returnself.monitoring_active Falseself.start_button.config(statenormal)self.stop_button.config(statedisabled)self.monitoring_status_label.config(text已停止, foregroundred)# 记录监控结束时间if self.session_start_time:duration int(time.time() - self.session_start_time)hours duration // 3600minutes (duration % 3600) // 60seconds duration % 60duration_str f{hours:02d}:{minutes:02d}:{seconds:02d}self.save_to_log_file(f[{datetime.now().strftime(%Y-%m-%d %H:%M:%S)}] 监控结束 (本次运行时长: {duration_str}, 连接: {self.session_connection_count}, 断开: {self.session_disconnection_count}), INFO)if self.monitor_thread:self.monitor_thread.join(timeout2)timestamp datetime.now().strftime(%Y-%m-%d %H:%M:%S)self.log_event(f[{timestamp}] ⏹️ 停止监控, info)self.log_event(f[{timestamp}] 本次监控统计: 连接次数{self.session_connection_count}, 断开次数{self.session_disconnection_count}, 运行时间{self.runtime_label.cget(text)}, info)# 保存统计数据self.save_statistics()def show_error(self, message):显示错误信息在日志区域error_msg f[{datetime.now().strftime(%H:%M:%S)}] ❌ 错误: {message}self.log_event(error_msg, error)def quit_app(self):退出应用程序# 记录程序关闭try:end_time datetime.now().strftime(%Y-%m-%d %H:%M:%S)log_entry f[{end_time}] 程序关闭 \nwith open(LOG_FILE, a, encodingutf-8) as f:f.write(f{log_entry}\n)except:pass# 保存统计数据self.save_statistics()# 停止监控self.stop_monitoring()# 关闭窗口self.root.quit()self.root.destroy()def on_closing(self):窗口关闭事件处理self.quit_app()def main():if not SERIAL_AVAILABLE:print(请先安装pyserial模块: pip install pyserial)input(按Enter键退出...)returnroot tk.Tk()# 设置窗口样式root.style ttk.Style()root.style.theme_use(clam)app USBMonitorApp(root)# 设置窗口关闭事件root.protocol(WM_DELETE_WINDOW, app.on_closing)# 设置窗口图标可选try:root.iconbitmap(defaulticon.ico)except:passroot.mainloop()if __name__ __main__:main()

相关文章:

USB设备端口识别监测嵌入式python3自动化测试脚本

软件版本:python3;编译器:IDLE编译器;库:PyAutoGUl库;cmd终端安装PyAutoGUl库命令:pip install pyautogui一、应用场景简介嵌入式设备测试开发中,开关机测试;监控特定USB…...

RVC WebUI性能调优:浏览器兼容性、响应延迟与并发处理优化

RVC WebUI性能调优:浏览器兼容性、响应延迟与并发处理优化 1. 引言 如果你用过RVC WebUI,大概率遇到过这样的场景:好不容易把模型训练好了,兴致勃勃地打开推理界面,结果页面加载慢得像蜗牛,点个按钮半天没…...

【Dv3Admin】FastCRUD富文本编辑器操作

富文本字段放进后台表单后,最常见的问题不是能不能显示,而是编辑区尺寸失控、弹窗布局被撑开、列表页误展示大段内容。表现通常集中在高度不稳定、宽度跟随栅格异常变化、空内容校验失效,排查时很容易把问题混到编辑器本体、表单布局、上传配…...

Vue3 实战:从 0 搭建企业级后台管理系统(Router+Pinia+Axios+Element Plus 全整合)

前言后台管理系统是前端开发中最常见的业务场景之一,也是 Vue 生态工具整合应用的典型案例。很多新手在学习 Vue3 时,往往只会单独使用某个工具(比如只写路由、只做状态管理),但到了实际项目中,如何把 Vue …...

如何在基础设施安全中有效实现GNSS位移监测的应用?

在基础设施安全中,应用单北斗GNSS位移监测技术至关重要。其核心在于北斗形变监测传感器的高精度数据采集能力,为桥梁、大坝等重要构筑物提供实时监测。GNSS变形监测系统通过持续跟踪位移,确保及时发现可能的安全隐患。通过科学部署和适当维护…...

StructBERT中文-large模型部署案例:中文科研基金申报书查重系统

StructBERT中文-large模型部署案例:中文科研基金申报书查重系统 1. 引言:当科研诚信遇上AI查重 每年科研基金申报季,评审专家们都会面临一个头疼的问题:如何从海量的申报书中,快速、准确地识别出那些可能存在抄袭或高…...

Ostrakon-VL-8B多场景落地实战:商品识别、文字提取、视频理解一体化部署案例

Ostrakon-VL-8B多场景落地实战:商品识别、文字提取、视频理解一体化部署案例 1. 引言:当AI走进零售后厨 想象一下这个场景:一家连锁超市的区域经理,需要在一个上午内巡查完辖区内5家门店。他要检查每家店的商品陈列是否合规、价…...

MusicGen-Small创意实验:混合风格音乐生成

MusicGen-Small创意实验:混合风格音乐生成 1. 从零开始:你的AI音乐创作之旅 你是否曾经想过,不需要学习乐器,不需要懂乐理,只需要用文字描述,就能创作出属于自己的音乐?现在,这一切…...

nomic-embed-text-v2-moe效果展示:工业设备说明书中英文故障描述匹配

nomic-embed-text-v2-moe效果展示:工业设备说明书中英文故障描述匹配 1. 模型能力概览 nomic-embed-text-v2-moe是一款专为多语言场景设计的文本嵌入模型,在工业设备故障描述匹配这类专业领域表现出色。这个模型最大的特点是能够理解100多种语言&#…...

Ostrakon-VL-8B入门必读:Food-Service与Retail Store场景专用提示词库

Ostrakon-VL-8B入门必读:Food-Service与Retail Store场景专用提示词库 你是不是也遇到过这样的问题?面对一张餐厅后厨的照片,想知道卫生状况如何,却不知道该怎么问AI。或者看到一张超市货架的图片,想分析商品陈列效果…...

比迪丽WebUI常见问题解决指南:打不开/生成失败/画质模糊全解析

比迪丽WebUI常见问题解决指南:打不开/生成失败/画质模糊全解析 1. 引言:从兴奋到困惑,你的比迪丽WebUI还好吗? 想象一下这个场景:你满怀期待地部署好了比迪丽WebUI,准备开始创作《龙珠》中那位英姿飒爽的…...

MedGemma X-Ray实战教程:开源医疗AI模型镜像免配置部署与Gradio界面调优

MedGemma X-Ray实战教程:开源医疗AI模型镜像免配置部署与Gradio界面调优 1. 为什么你需要一个“会看片”的AI助手? 你是否遇到过这些场景:医学生刚接触放射科,面对一张密密麻麻的胸片不知从何下手;科研人员想快速验证…...

nlp_structbert_siamese-uninlu_chinese-base环境部署:requirements依赖安装与缓存路径配置

nlp_structbert_siamese-uninlu_chinese-base环境部署:requirements依赖安装与缓存路径配置 1. 引言 如果你正在寻找一个能“一专多能”处理中文文本的AI模型,那么SiameseUniNLU很可能就是你的答案。想象一下,你有一个文本分析需求&#xf…...

Janus-Pro-7B教育落地:试卷扫描图识别+知识点标注+错题归因

Janus-Pro-7B教育落地:试卷扫描图识别知识点标注错题归因 1. 引言:当AI老师遇上纸质试卷 想象一下这个场景:一位老师批改完一个班级的数学试卷,面对几十份试卷,他需要手动统计每道题的得分情况,分析每个学…...

乙巳马年春联生成终端入门必看:PALM模型输入输出格式与token限制

乙巳马年春联生成终端入门必看:PALM模型输入输出格式与token限制 1. 引言:从“愿望词”到“金玉良言”的魔法 想象一下这个场景:新春将至,你想为自家大门或公司前台写一副应景的春联,既要体现马年“龙马精神”的寓意…...

SiameseUIE在招聘JD分析中的应用:职位/技能/学历/薪资多维度抽取

SiameseUIE在招聘JD分析中的应用:职位/技能/学历/薪资多维度抽取 招聘季一到,HR和业务负责人就头疼。每天面对海量的招聘需求,光是整理和分析岗位描述(Job Description,简称JD)就耗费大量时间。一份JD里&a…...

Ollama镜像高性能实践:AI股票分析师支持并发10+股票实时分析

Ollama镜像高性能实践:AI股票分析师支持并发10股票实时分析 1. 项目概述 AI股票分析师daily_stock_analysis是一个基于Ollama本地大模型框架构建的私有化金融分析应用。这个镜像的核心价值在于将专业级的股票分析能力本地化部署,让用户无需依赖外部API…...

ClawdBot真实案例:用户上传餐厅菜单图片→OCR识别→翻译成德语结果

ClawdBot真实案例:用户上传餐厅菜单图片→OCR识别→翻译成德语结果 1. 引言:当AI助手遇上跨国点餐难题 想象一下这个场景:你走进一家异国餐厅,菜单上密密麻麻的外文让你一头雾水。服务员忙得不可开交,你也不好意思一…...

Stable-Diffusion-v1-5-archiveAIGC内容合规:生成结果版权归属与商用风险提示

Stable Diffusion v1.5 Archive:AIGC内容合规与商用风险全解析 1. 引言:当AI绘画遇上版权与合规 最近几年,AI绘画工具像雨后春笋一样冒出来,其中Stable Diffusion系列模型可以说是这个领域的“老大哥”。特别是SD1.5这个版本&am…...

Janus-Pro-7B GPU显存精控:16GB卡上动态卸载+缓存清理实操步骤

Janus-Pro-7B GPU显存精控:16GB卡上动态卸载缓存清理实操步骤 1. 为什么16GB显存不够用? 如果你在16GB显存的GPU上运行Janus-Pro-7B,可能会遇到一个让人头疼的问题:模型加载时显存占用就接近14-15GB,稍微操作几下就爆…...

【学习记录】1.PS.2.如何给图片打马赛克?

[学习记录]1.PS.2.如何给图片打马赛克? 解决办法: 1.先分离新建图层 Ctrlj 新建图层2.选中新建图层,设置马赛克大小 在 滤镜 / 像素化 / 马赛克 里 然后选择马赛克的模糊程度,然后点击确定3.选中新建图层并添加图片图片蒙版4.…...

C++记一次文件输入字符串解析成数字不正常的情况

使用C语言做文件读取&#xff0c;使类似于0x0a0a0a0a字符串能正常转换成uint32_t类型&#xff0c;中间用到了stoi函数。 代码如下&#xff1a; string s; while (!infile.eof()) { infile >> s; cout << stoi(s, nullptr, 0); //自动进行进制转换 } 可是程序执行总…...

解锁 C 语言 “积木术”:大一函数总结

大一 C 语言函数核心总结 本文围绕 C 语言函数从基础认知到实战运用、从核心语法到避坑技巧展开&#xff0c;兼顾基础考点与编程思想&#xff0c;内容可直接用于复习和实操参考&#xff0c;每个核心模块仅保留 2 个典型示例&#xff0c;多余拓展示例文末有补充。 一、函数的基…...

计算机毕业设计之基于Spring Boot的易家宜超市云购物系统

易家宜超市云购物系统采用B/S架构&#xff0c;数据库是MySQL。网站的搭建与开发采用了先进的java进行编写&#xff0c;使用了springboot框架。该系统从两个对象&#xff1a;由管理员和用户来对系统进行设计构建。主要功能包括&#xff1a;个人信息修改&#xff0c;对用户、商品…...

SpringBoot 多实现类实战:告别 if-else,拥抱策略模式

在 SpringBoot 开发中&#xff0c;一个接口对应多个实现类是极其常见的场景&#xff0c;例如支付方式&#xff08;微信、支付宝、银联&#xff09;、通知渠道&#xff08;短信、邮件、钉钉&#xff09;或登录策略&#xff08;密码、验证码、第三方&#xff09;。如果处理不当&a…...

公务员暂停工伤保险

登录进入办理页面 暂停工伤保险适合调出、退休人员上传附件点击提交 退休选择工伤养老保险基数 公积金医疗保险基数...

着色器multi_compile笔记

概述一句multi_compile后面写若干个关键字XXX&#xff0c;在代码里用#if XXX条件编译一段代码。开启、关闭关键字关键字的开启关闭在材质debug界面。在Valid Keywords填的关键字如果在某句multi_compile里会自动进入Valid Keywords&#xff0c;否则进入Invalid。代码开启关键字…...

【愚公系列】《剪映+DeepSeek+即梦:短视频制作》007-拍摄基础:参数设置与镜头语言解析(景别与镜头运动)

&#x1f48e;【行业认证权威头衔】 ✔ 华为云天团核心成员&#xff1a;特约编辑/云享专家/开发者专家/产品云测专家 ✔ 开发者社区全满贯&#xff1a;CSDN博客&商业化双料专家/阿里云签约作者/腾讯云内容共创官/掘金&亚马逊&51CTO顶级博主 ✔ 技术生态共建先锋&am…...

【愚公系列】《剪映+DeepSeek+即梦:短视频制作》006-拍摄基础:参数设置与镜头语言解析(短视频的参数设置)

&#x1f48e;【行业认证权威头衔】 ✔ 华为云天团核心成员&#xff1a;特约编辑/云享专家/开发者专家/产品云测专家 ✔ 开发者社区全满贯&#xff1a;CSDN博客&商业化双料专家/阿里云签约作者/腾讯云内容共创官/掘金&亚马逊&51CTO顶级博主 ✔ 技术生态共建先锋&am…...

Python爬虫实战:监听前端网络流,aiohttp 极速并发抓取淘宝直播排行榜!

㊗️本期内容已收录至专栏《Python爬虫实战》&#xff0c;持续完善知识体系与项目实战&#xff0c;建议先订阅收藏&#xff0c;后续查阅更方便&#xff5e; ㊙️本期爬虫难度指数&#xff1a;⭐⭐⭐ &#x1f250;福利&#xff1a; 一次订阅后&#xff0c;专栏内的所有文章可永…...