CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Assignment 2: Gumball Machines
Due: 23:59, Thu 3 Oct 2024 File name: gumball.cpp Full marks: 100
Introduction
The objective of this assignment is to let you practice control flow structures in C++. It also involves the use of variables, operators, expressions, and standard input/output to reinforce your learning in the course thus far. You are to write a program to print an ASCII character pattern resembling the drawing of a gumball vending machine, such as Figure 1 below.
container
_____ /____\ // \\ // \\ // OOOOO\\ //OOOOOOO\\ \\OOOOOOO// \\OOOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| |
𝑛 = side length of the hexagon gum
gum flap (chute door)
𝑛 = side length of the square
stand || || |_ _ _ _ _|
Figure 1: A sample character pattern resembling a gumball machine This gumball machine character pattern is composed of two parts:
1. Container: A hexagonal shape in double dashed lines is used to represent the container holding the gumballs. Each gumball is denoted by a capital letter 'O'.
2. Stand: A square shape below the hexagon is used to represent the stand supporting the gumball container. A small square of unit length (always at the center of the 2nd line) inside this stand shape is used to represent the chute door, i.e., the opening where gumballs come out.
The whole pattern is formed from the set of characters in Table 1 below. Table 1: Characters for printing the ASCII art drawing
Character
Name of the Character
_ Underscore
| Pipe (Vertical bar)
\ Backslash
/ Forward slash
O Letter O (denoting a gum)
Space Copyright © 2024 CSE, CUHK
Page 1 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Instead of hardcoding, you are required to use loops and conditionals to print the drawing whose size can be scaled up or down according to the user input (See Table 2 for examples).
User Input
There are two user inputs required at the program start.
1. Side length (𝑛): it is the side length of the hexagon (or the square). This input controls the number of underscores that form the outer edge of the hexagon.
2. Stock of gumballs (𝑠𝑡𝑜𝑐𝑘): the initial number of gumballs to load into the vending machine.
Due to the double dashed line design of the hexagon and the spaces involved, the maximum number of gumballs that can be put into the container, i.e., its capacity (𝑐), is limited and determined by the following formula (deduced from the sum formula of an arithmetic series):
𝑐 = 3𝑛! − 8𝑛 + 5 ... (1)
Input validation
1. If the side length (𝑛) is smaller than 3, there is not enough room to print the chute door. When 𝑛 is getting too big, the output may overrun your terminal width and look distorted due to line wrapping. So, let us assume its valid range is between 3 and 29. (Note: in case you still see line wrapping issues in this range, you may resize your terminal via its settings.)
2. The initial number gumballs (𝑠𝑡𝑜𝑐𝑘) to load into the machine must lie between ⌊𝑐/2⌋ (floor of the division) and 𝑐, inclusive.
If the user input falls outside the valid range, the program will terminate immediately with an error message. See the Sample Runs section.
Size Scaling
Table 2 shows some examples to explain how the container shape and its capacity (𝑐) scale with the side length (𝑛) input.
Note that for making the width and height of the hexagon (or square) look similar in the console, we put a single space between every two underscores or two letter O’s in a horizontal line. For better visualization of the spaces required to produce the output, we used the symbol ␣ to denote a space character.
Machine Operations
Besides printing the gumball machine, the program will also prompt the user to enter a quantity of gumballs to buy. When the user enters a valid value (between 1 and 𝑠𝑡𝑜𝑐𝑘), the quantity will be deducted from the stock and there will be fewer O’s shown in the next printout of the gumball machine. The program keeps repeating these operations until running out of stock.
Copyright © 2024 CSE, CUHK Page 2 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Table 2: Sample output versus side length (𝑛) 𝒏3456
𝒄8 21 40 65
␣␣␣␣_␣_␣_ ␣␣/␣␣_␣_␣␣\ ␣/␣/␣O␣O␣\␣\ /␣/␣O␣O␣O␣\␣\ \␣\␣O␣O␣O␣/␣/ ␣\␣\␣_␣_␣/␣/ ␣␣\␣_␣_␣_␣/ ␣␣␣|␣␣_␣␣| ␣␣␣|␣|_|␣| ␣␣␣|_␣_␣_|
␣␣␣␣␣_␣_␣_␣_ ␣␣␣/␣␣_␣_␣_␣␣\ ␣␣/␣/␣O␣O␣O␣\␣\ ␣/␣/␣O␣O␣O␣O␣\␣\ /␣/␣O␣O␣O␣O␣O␣\␣\ \␣\␣O␣O␣O␣O␣O␣/␣/ ␣\␣\␣O␣O␣O␣O␣/␣/ ␣␣\␣\␣_␣_␣_␣/␣/ ␣␣␣\␣_␣_␣_␣_␣/ ␣␣␣␣|␣␣␣_␣␣␣| ␣␣␣␣|␣␣|_|␣␣| ␣␣␣␣|␣␣␣␣␣␣␣| ␣␣␣␣|_␣_␣_␣_|
␣␣␣␣␣␣_␣_␣_␣_␣_ ␣␣␣␣/␣␣_␣_␣_␣_␣␣\ ␣␣␣/␣/␣O␣O␣O␣O␣\␣\ ␣␣/␣/␣O␣O␣O␣O␣O␣\␣\ ␣/␣/␣O␣O␣O␣O␣O␣O␣\␣\ /␣/␣O␣O␣O␣O␣O␣O␣O␣\␣\ \␣\␣O␣O␣O␣O␣O␣O␣O␣/␣/ ␣\␣\␣O␣O␣O␣O␣O␣O␣/␣/ ␣␣\␣\␣O␣O␣O␣O␣O␣/␣/ ␣␣␣\␣\␣_␣_␣_␣_␣/␣/ ␣␣␣␣\␣_␣_␣_␣_␣_␣/ ␣␣␣␣␣|␣␣␣␣_␣␣␣␣| ␣␣␣␣␣|␣␣␣|_|␣␣␣| ␣␣␣␣␣|␣␣␣␣␣␣␣␣␣| ␣␣␣␣␣|␣␣␣␣␣␣␣␣␣| ␣␣␣␣␣|_␣_␣_␣_␣_|
␣␣␣␣␣␣␣_␣_␣_␣_␣_␣_ ␣␣␣␣␣/␣␣_␣_␣_␣_␣_␣␣\ ␣␣␣␣/␣/␣O␣O␣O␣O␣O␣\␣\ ␣␣␣/␣/␣O␣O␣O␣O␣O␣O␣\␣\ ␣␣/␣/␣O␣O␣O␣O␣O␣O␣O␣\␣\ ␣/␣/␣O␣O␣O␣O␣O␣O␣O␣O␣\␣\ /␣/␣O␣O␣O␣O␣O␣O␣O␣O␣O␣\␣\ \␣\␣O␣O␣O␣O␣O␣O␣O␣O␣O␣/␣/ ␣\␣\␣O␣O␣O␣O␣O␣O␣O␣O␣/␣/ ␣␣\␣\␣O␣O␣O␣O␣O␣O␣O␣/␣/ ␣␣␣\␣\␣O␣O␣O␣O␣O␣O␣/␣/ ␣␣␣␣\␣\␣_␣_␣_␣_␣_␣/␣/ ␣␣␣␣␣\␣_␣_␣_␣_␣_␣_␣/ ␣␣␣␣␣␣|␣␣␣␣␣_␣␣␣␣␣| ␣␣␣␣␣␣|␣␣␣␣|_|␣␣␣␣| ␣␣␣␣␣␣|␣␣␣␣␣␣␣␣␣␣␣| ␣␣␣␣␣␣|␣␣␣␣␣␣␣␣␣␣␣| ␣␣␣␣␣␣|␣␣␣␣␣␣␣␣␣␣␣| ␣␣␣␣␣␣|_␣_␣_␣_␣_␣_|
Program Specification
1. The program first prompts the user for the side length 𝑛.
2. If 𝑛 is invalid (not between 3 and 29), the program prints an error message and terminates.
3. Print the machine capacity 𝑐, given by equation (1).
4. Prompt the user for the 𝑠𝑡𝑜𝑐𝑘 of gumballs.
5. If 𝑠𝑡𝑜𝑐𝑘 is invalid (not between ⌊𝑐/2⌋ and 𝑐), print an error message and terminate the program.
6. Print the gumball machine using loops and conditionals. This step comprises more subtasks like:
a. Determine the left padding, i.e., how many spaces to print before /, \ or | per row. b. Print the hexagonal part.
c. Align the current stock of gumballs properly inside the container.
d. Print the square part.
7. Prompt the user for the quantity 𝑞 to buy.
8. If 𝑞 is invalid (not between 1 and 𝑠𝑡𝑜𝑐𝑘), print an error message and go back to step 6.
9. Deduct 𝑞 from 𝑠𝑡𝑜𝑐𝑘.
10. If 𝑠𝑡𝑜𝑐𝑘 > 0, go back to step 6.
11. Print the message "Sold out!" finally.
Note two important points:
• (Regarding 6.b) For a hexagon container full of gumballs, the number of gumballs varies by one
when going from one row to the next, except the two rows in the middle of the hexagon.
• (Regarding 6.c) Gumballs are dispensed or “consumed” in a top-to-bottom, left-to-right manner. The gumballs on the top row should be aligned to the right if their count is less than the row’s capacity (see Figure 1 again). Once consumed, the letter 'O' denoting a gumball will be replaced
by a space character.
Assumptions: You can assume that all user inputs are always entered as integers. The program behavior beyond this assumption can be indeterminate and your program behavior can be different from our sample program.
Copyright © 2024 CSE, CUHK Page 3 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Restrictions: You are NOT allowed to use any arrays, vectors, or any other data containers in this assignment. You may use the string class (e.g., to store a line of characters if you see fit) but you cannot use its at() method or the subscript operator [] to traverse the individual characters of a string. Defining your own functions or macros is allowed but not mandatory.
Sample Runs
In the following sample runs, the blue numbers after ':' are user inputs and the other text is the program printout. You can try the provided sample program for other inputs. Your program printout shall be exactly the same as the sample program (same text, symbols, letter case, spacings, etc.). Note that there is a space after the ':' included in each input prompt.
Enter side length: -1↵ Invalid side length!
Enter side length: 30↵ Invalid side length!
Enter side length: 4↵
Machine capacity: 21
Enter gumball stock: 9↵
Too few / many gumballs to load!
Enter side length: 4↵
Machine capacity: 21
Enter gumball stock: 22↵
Too few / many gumballs to load!
Enter side length: 6↵
Machine capacity: 65
Enter gumball stock: 31↵
Too few / many gumballs to load!
Enter side length: 4↵ Machine capacity: 21 Enter gumball stock: 10↵
____ /___\ // \\ // \\ // O\\ \\OOOOO// \\OOOO// \\___// \____/ |_|
| |_| | ||
|_ _ _ _|
Enter quantity to buy: 1↵ Copyright © 2024 CSE, CUHK
Page 4 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
____ /___\ // \\ // \\ // \\ \\OOOOO// \\OOOO// \\___// \____/ |_|
| |_| | ||
|_ _ _ _| Enter quantity to ____ /___\ // \\ // \\ // \\ \\ // \\OOOO// \\___// \____/ |_|
| |_| | ||
|_ _ _ _| Enter quantity to Invalid quantity! ____ /___\ // \\ // \\ // \\ \\ // \\OOOO// \\___// \____/ |_|
| |_| | ||
|_ _ _ _| Enter quantity to ____ /___\ // \\ // \\ // \\ \\ // \\ // \\___// \____/ |_|
| |_| | ||
|_ _ _ _|
Sold out!
buy: 5↵
buy: 5↵
buy: 4↵
Copyright © 2024 CSE, CUHK
Page 5 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Enter side length: 5↵ Machine capacity: 40 Enter gumball stock: 25↵
_____ /____\ // \\ // \\ // \\ //OOOOOOO\\ \\OOOOOOO// \\OOOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Enter quantity to buy: 26↵ Invalid quantity!
_____ /____\ // \\ // \\ // \\ //OOOOOOO\\ \\OOOOOOO// \\OOOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Enter quantity to buy: 0↵ Invalid quantity!
_____ /____\ // \\ // \\ // \\ //OOOOOOO\\ \\OOOOOOO// \\OOOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Enter quantity to buy: 10↵ Copyright © 2024 CSE, CUHK
Page 6 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
_____ /____\ // \\ // \\ // \\ // \\ \\ OOOO// \\OOOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Enter quantity to buy: 5↵ _____
/____\ // \\ // \\ // \\ // \\ \\ // \\ OOOOO// \\OOOOO// \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Enter quantity to buy: 10↵ _____
/____\ // \\ // \\ // \\ // \\ \\ // \\ // \\ // \\____// \_____/ |_|
| |_| | || ||
|_ _ _ _ _|
Sold out!
Copyright © 2024 CSE, CUHK
Page 7 of 8
CSCI1120 Introduction to Computing Using C++, Fall 2024/25
Department of Computer Science and Engineering, The Chinese University of Hong Kong
Submission and Marking
§ Your program file name shall be gumball.cpp. Submit the file in Blackboard (https://blackboard.cuhk.edu.hk/).
§ Insert your name, student ID, and e-mail as comments at the beginning of your source file. // CSCI1120 Assignment 2
// Name:
// Student ID:
// Email: (the one that you check most often)
§ You can submit your assignment multiple times. Only the latest submission counts.
§ Your program shall be free of compilation errors and warnings when built in VS Community 2022.
§ Your program shall include suitable comments as documentation.
§ Do NOT share your work to others and do NOT plagiarize. Both senders and plagiarists shall be
相关推荐
决策树(分类树、回归树)
决策树 前言:第一篇博客,最近看完决策树,想着归纳一下,也方便自己以后回顾。写的会比较全面一些,可能会有很多不太正确的地方,欢迎大家交流指正 : ) 决策树模型: 决策树模型是运用于分类以及回归的一种树结构。决策树由节点和有向边组成,一般一棵决策树包含一个根节点、若干内部节点和若干叶节点。决策树的决策过程需要从决策树的根节点开始,待测数据与决策树中的特征节点进行比较,并按照比较结果选...
CSCI1120 C++
container| |_| |CharacterUser Input𝑐 = 3𝑛!" finally.| |_| | |||_ _ _ _|| |_| | ||| |_| | ||| |_| | ||| |_| | |||_ _ _ _|
探索Vortex开源GPGPU:RISC-V SIMT架构(4-1),Execute SFU(1)
本文详细分析了Vortex RISC-V内核6级流水线中Execute阶段的SFU(特殊功能单元)模块。重点介绍了SFU的数据流结构,包含dispatch_unit、pe_switch、csr_unit、wctl_unit和gather_unit五个子模块。文章深入解析了warp控制指令wspawn和tmc的实现机制:wspawn用于激活指定数量的warp并设置新PC值,tmc则用于控制线程掩码和warp状态。通过C代码和汇编指令的对照分析,阐明了这些指令在并行计算中的关键作用,包括线程激活、状态切换和执行
CSCI1120 Computing Using C++
Mathableandoatokenonasquare,hemay,atthatmoment,takeanextratoken(fromthebag)if hesowishes.ThismaynotbeoBonussquaresSquare.hN2Y3N4Player.hN5Bot.hN6Man.hN7Mathable.hN8NP= 4,N。
VerilogEval实战指南:从基准测试到模型微调的全流程解析
本文提供了VerilogEval实战指南,详细解析了从基准测试到模型微调的全流程。VerilogEval是一个自动化、标准化的测试框架,用于客观评估大语言模型生成Verilog硬件代码的能力。文章涵盖了环境搭建、核心机制解析、利用其生成合成数据进行模型微调的策略,以及如何将其工程化集成到自动化评估流程中,为硬件设计领域的AI应用提供了完整的方法论。
鸿蒙平板PC应用开发:在termux中安装ubuntu
打开AVNC点击右上角的设置图标,然后点击 输入 , 点击手势栏目中的 单指轻扫 ,选择滚动远程内容
CSCI1120 Introduction to Computing Using C++ Fall 2024/25 4: MathableC/C++
File name:Mathable•Gameboard•Tokens(ortiles•Racks•Bag•Score padequationsa?b = cwhere?Amathequationiscompletedbyadding,oradjacentnumbersputtinga tokensquare,beittotherightorleft,belowor。
Zephyr RTOS详解
Zephyr 是一个开源的实时操作系统(RTOS),专为资源受限的嵌入式设备设计,支持多种架构(如 ARM Cortex-M、RISC-V、x86 等)。
RNNoise-SpeexDSP-WebRTC使用说明
本文介绍RNNoise、SpeexDSP与WebRTC音频处理库的下载、调用及参数配置方法,适用于Android语音工程集成。RNNoise基于深度学习,适合非稳态噪声降噪,需48kHz输入;SpeexDSP支持多采样率与回声消除,适用于全双工场景;WebRTC提供轻量级窄带处理。三者可串联使用:麦克风信号先经前级降噪(RNNoise或SpeexDSP),再进入WebRTC媒体引擎进行编码。重点说明各库的典型应用场景、接口调用方式、关键参数调节策略及采样率转换注意事项,帮助开发者高效集成与优化语音处理链路。
FDTD Script命令学习-farfield3d/farfieldux/farfielduy
介绍了farfield3d/farfieldux/farfielduy命令功能,及不同应用语法和参数介绍,以及对官网示例进行介绍。
第12篇:TMC2240 CoolStep节能功能|软件配置+功耗测试(保姆级)
本文介绍了TMC2240驱动芯片的CoolStep节能功能,通过动态调节电机电流实现功耗优化。CoolStep利用StallGuard技术实时检测负载,自动调整运行电流,空载时可降低50%以上功耗。文章详细讲解了节能原理、寄存器配置方法和参数校准步骤,提供可直接复用的STM32代码。该功能特别适合电池供电设备,能显著延长续航时间,同时保持电机性能稳定。配置时需注意SG阈值、电流步长等关键参数,并可与静音模式叠加使用。
基于深度学习的商品评论情感分析系统-毕业设计
面向商品评论的中文情感分析系统,支持单条预测、批量分析、情感分布与关键词、报告导出。TextCNN、BiLSTM、Transformer 在同一词表、同一数据切分、同一种子与超参下公平对比,测试集 F1 分别为 0.9101、0.9089、0.9075。结论是这一规模下模型复杂度未带来收益,但误差结构不同。附技术栈、截图、文档预览与演示视频。
YOLO11改进-注意力-引入Deformable Large Kernel Attention (DLKA) 解决多尺度、小目标、遮挡等问题
Deformable Large Kernel Attention (DLKA) 是一种用于视觉任务的注意力机制,旨在提升模型在处理不同尺寸和形状对象时的灵活性和性能。DLKA 的设计灵感源自传统的注意力机制,但通过引入可变形核(deformable kernel)来增强对局部特征的适应能力。
Transformer 为什么能取代 RNN?从自注意力讲起
2017 年谷歌在《Attention Is All You Need》中提出 Transformer,核心是。它如今是 GPT、BERT、ChatGPT 的共同底座。
Devexpress16.2.6破解工具
Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具
VC中sqlite的使用
在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示
【原创深度学习项目】基于深度学习的建筑工地防护装备检测系统|安全帽与反光衣检测系统(RT-DETR-L 模型)
本文设计并实现了一套基于RT-DETR-L的建筑工地防护装备检测系统,采用Django+Vue前后端架构,实现对安全帽、反光背心等7类装备及“无PPE”“未戴安全帽”等缺失状态的精准识别。系统支持图片、视频、摄像头实时检测,具备参数可调、数据可视化与统计分析功能,有效解决小目标漏检、误检及管理难问题,助力智慧工地安全管理落地。文末可获取源码。
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
图解循环神经网络(RNN)
RNN(循环神经网络)就是“带记忆的网络”:让网络拥有一块“记忆”,在处理当前数据时,能同时参考之前看过的内容;它不一次性看完全部输入,而是像人读书一样,一个字一个字地读,每读一个字就更新一次脑子里的记忆,然后用这份记忆去理解当前这个字。但便签一直在被改写,新信息不断挤占旧信息,传到第 40 步时,“巴黎”的痕迹已经淡得几乎没了。读到“贵”的时候,网络并没有重新去查“好看”这个词——但“好看”的影响已经融在了便签里(那个 1.5)。这三个困难的共同点:答案不在当前这一个字里,而在“前面那串东西”里。
神经网络入门指南:从 CNN、RNN 到 Attention
神经网络的学习,本质是“预测—比较—纠错”的循环;CNN 通过局部连接与权重共享理解图像;RNN 通过隐藏状态传递上下文;LSTM 和 GRU 用门控机制管理记忆;Encoder–Decoder 把理解与生成拆成两个阶段;Attention 则让模型在每一步都能主动寻找最相关的信息。到这里,我们已经走完了从普通神经网络到 Attention 的完整路线。下一篇将正式进入 Transformer,看看它如何摆脱 RNN 的顺序计算,又如何让每个 Token 直接找到与自己相关的信息。
AI 学习第 15 课:变长序列不 pack 直接喂 RNN,隐状态全被 0 污染
NLP 的 batch 里句子长短不一,短句垫 0 补齐后直接喂 RNN,看似能跑,实际上每个 0 垫步都在更新隐状态——短序列的最后一步输出根本不是它真实句子的结果。这一课用 torch 2.15(
CNN 卷积神经网络深度解析:卷积、池化与特征提取的底层原理
卷积核(Kernel),也叫滤波器(Filter),本质上是一个可以训练的权重矩阵。1 0 -11 0 -11 0 -1这个卷积核可以对图像中的局部像素进行加权计算。不同的卷积核能够提取不同类型的特征:水平边缘特征垂直边缘特征纹理特征角点特征局部形状特征在传统图像处理中,滤波器通常由人工设计。而在 CNN 中,卷积核的权重通过训练数据和反向传播自动学习得到。这也是 CNN 能够自动提取图像特征的关键。# 第一层卷积padding=1# 第二层卷积padding=1。
图解常用深度学习优化器
来隐式构造 Hessian 逆的近似,从而直接估计出“谷底在哪”,而非仅仅判断“哪边最陡”。即SGD/Adam 主要看“当前坡度”,LBFGS 还会看“最近几步坡度怎么变”,像用局部地形图来规划路线。训练 Transformer 时,有些层梯度大,有些层梯度小。如果用 Adam + L2,梯度大的参数反而可能被“少衰减”,正则效果不稳定;:你要下山,但每次迈步前都要派侦察兵把整座山的每一个坡面都测量一遍,算出“绝对最陡”的方向才走一步。:还是下山,但这次你只问身边一个路人“哪边最陡”,然后就走。
【无标题】无人机视角道路坑洞坑洼目标检测数据集深度学习 目标检测 无人机航拍 道路坑洞 路面病害 YOLO格式 数据集发布9032期
(一)类别构成该数据集聚焦单一类别——坑洞(类别 ID 为 0),任务指向明确,围绕无人机俯视视角下的道路坑洞目标开展检测标注。类别体系精简,与公路路面病害巡检的实际需求高度契合,图像中的坑洞样本可直接作为路面破损识别的核心正样本,便于对接道路养护排查流程。(二)数据数量数据集规模为 3285 张无人机俯视航拍图像,采用标准 YOLO txt 标注格式,标注框总计 4457 个,其中带有效标注的图片 2007 张,全部图片均带有有效标注。
基于深度学习的猫图像目标检测方法研究:YOLOv8s模型海选、多种子对比训练与Django+ONNX部署实现详解
本课题基于深度学习研究猫图像目标检测问题。数据集含1000张猫图像、1188个标注框,按固定比例划分并冻结清单;训练前在多个候选族中短训海选,确定YOLOv8s为主模型,经学习率搜索与显存标定后完成150轮训练,验证集mAP50达到0.92,并以7个随机种子的对比实验验证稳定性。最优权重导出为ONNX接入Django系统,提供图片、视频、摄像头三种识别方式,配套识别记录管理与统计大屏,形成从训练到应用的完整闭环。
第 05/24 期:计算图与自动微分:深度学习如何计算梯度
本文系统阐述了神经网络训练中梯度计算的本质:损失对参数的敏感性。通过构建计算图,将复杂函数分解为基本运算,利用链式法则实现反向传播。核心在于反向模式自动微分——以一次前向计算为基础,通过传播输出对中间变量的敏感性,高效求得所有参数梯度。相比前向模式,反向模式在参数多、目标为标量的场景下更高效。计算图不仅适用于神经网络,也广泛适用于任意可微程序。关键思想是:梯度是局部导数与上游敏感性的乘积,分支路径的贡献需累加,从而保证导数计算的正确性与效率。
【深度学习项目实战·30】PM2.5短期预测:用LSTM构造没有未来信息的滑动窗口
本文基于北京PM2.5数据,使用LSTM实现从最近24小时历史观测预测下一小时PM2.5。重点解决时间切分、因果填补、滑动窗口构建与标准化等关键问题,确保模型仅依赖过去信息,避免未来泄漏。通过滚动单步预测与持续性基线对比,评估在原始单位下的MAE/RMSE,验证模型有效性。强调时间顺序与数据完整性,为时序预测提供可复现的实践框架。
无人机巡检道路路面异常检测数据集 深度学习 目标检测 无人机巡检 道路病害 路面异常 YOLO格式 数据集发布9028期
无人机巡检道路路面异常检测数据集 深度学习 目标检测 无人机巡检 道路病害 路面异常 YOLO格式 数据集发布9028期
深度学习 目标检测 无人机巡检 防震锤 电力设备 YOLO格式 数据集发布
深度学习 目标检测 无人机巡检 防震锤 电力设备 YOLO格式 数据集发布 9038期
AI 学习第 14 课:CNN 训 6 轮卡在 0.5352,数据没打乱
第 13 课把 Conv2d 的参数量和池化后的尺寸算清了,这课把卷积块拼成一个能训练的完整网络,跑满 6 个 epoch。第一版直接卡死:loss 从 2.6104 掉到 0.6989 就再也不动,
9万+



被折叠的 条评论
为什么被折叠?



