本项目包含一系列Python深度学习算法和计算机视觉实现的练习,涵盖了从基础算法到OpenCV图像处理的多个方面。学生需要补全 exercises 目录下的 Python 文件中缺失的代码,并通过本地测试或 GitHub Actions 自动测试来验证自己的实现是否正确。
exercises/iou.py: 实现目标检测中的交并比 (IoU) 计算。exercises/nms.py: 实现目标检测中的非极大值抑制 (NMS) 算法 (包含 IoU 计算)。exercises/conv.py: 手写实现二维卷积操作。exercises/leaky_relu.py: 实现 LeakyReLU 激活函数。exercises/maxpool.py: 实现最大池化操作。exercises/cross_entropy.py: 实现交叉熵损失函数。exercises/smooth_l1.py: 实现 Smooth L1 损失函数。exercises/image_processing.py: 使用 OpenCV 实现图像边缘检测等基本处理。exercises/contour_detection.py: 使用 OpenCV 实现图像轮廓检测。exercises/ 目录中找到对应的 .py 练习文件(例如 exercises/iou.py)。# 请在此处编写代码 或有 pass 语句的地方,根据提示完成函数或方法的实现。python -m pytest tests/ -v 来检查您的代码是否能通过测试用例。您可以先只关注您正在做的那个练习对应的测试文件,例如 python -m pytest tests/test_iou.py -v。建议按照练习文件名的隐含顺序或上述列表顺序学习,从基础算法到图像处理应用:
iou.py, nms.py)。conv.py, leaky_relu.py, maxpool.py, cross_entropy.py, smooth_l1.py)。image_processing.py, contour_detection.py)。requirements.txt 文件,主要包括:
numpyopencv-pythonpytestPython-Training-Camp-Advanced/ ├── .github/workflows/ # GitHub Actions 工作流配置 │ └── test.yml ├── exercises/ # 学员练习目录 (需要填空的 .py 文件) │ ├── contour_detection.py │ ├── conv.py │ ├── cross_entropy.py │ ├── image_processing.py │ ├── iou.py │ ├── leaky_relu.py │ ├── maxpool.py │ ├── nms.py │ └── smooth_l1.py ├── picture/ # 可能包含测试用的图片资源 ├── tests/ # Pytest 测试文件 │ ├── test_contour_detection.py │ ├── test_conv.py │ ├── # ... (其他测试文件) │ └── test_smooth_l1.py ├── .gitignore # Git 忽略文件配置 ├── README.md # 项目说明文件 (本文件) ├── requirements.txt # Python 依赖库列表 ├── score_calculator.py # 用于计算分数的脚本 └── test_score.txt # 分数计算结果(示例或运行时生成)
# 建议在虚拟环境中操作
# python -m venv venv
# source venv/bin/activate # Linux/macOS
# venv\Scripts\activate # Windows
pip install -r requirements.txt
# 运行所有测试
python -m pytest tests/ -v
# 运行特定测试文件
python -m pytest tests/test_iou.py -v
git push 到您 Fork 的 GitHub 仓库。pytest 的输出以及 score_calculator.py 生成的分数报告 (test_score.txt 会作为 artifact 上传)。pass 语句的函数体。answers/ 目录下的答案。当您推送代码后,GitHub Actions 会自动执行以下流程:
pytest 对您在 exercises/ 目录下的代码进行测试。continue-on-error: true)。score_calculator.py 脚本,该脚本可能会根据 pytest 的测试结果(例如解析生成的 test-results.xml 文件)来计算一个分数。test_score.txt 文件中。test_score.txt 和 test-results.xml 文件会作为构建产物 (Artifacts) 上传,您可以在 Actions 运行详情页面下载它们以查看详细结果。最终评价基于 score_calculator.py 计算出的分数。
docker build -t docker.cnb.cool/momo.mo/python-training-advanced:latest .ide
docker build -t docker.cnb.cool/MOMO.MO/python:latest .ide
docker.cnb.cool/opencamp/learning-ai/ai-course-lab-basic:latest
docker push docker.cnb.cool/momo.mo/python-training-advanced:latest