MAT301 Python/Java

Java Python Problems for Submission
MAT301
Guidelines
Submission
These problems are due each Thursday morning at 10 a.m. We are planning to use Crowd-
mark for submission of assignments. It will be linked on the course website. You should
prepare the problems separately (on separate pages, in separate files).1
Make sure that you save all of your files as a pdf. Other formats are not readable to graders
are will not be graded (that is, they will be treated as if you had not submitted it).
Grading & Feedback of Problems
Each problem will be graded according to the following scale:
? Proofs
– 1 point = mastered (generally, mastered means that it is (a) a correct proof and
(b) the grader can understadn it)
– 0 points = not yet mastered
? Explore
– 1 point = complete and demonstrates engagement
– 1/2 point = complete but doesn’t show engagement (i.e.
– 0 points = incomplete
The way to think about the scores is a measure of your progress, not potential.
Be aware that this usually results in a lower percentage grade than students are used to -
unless you get a perfect assignment, students often get 50% at first. This can seem shocking
to some students!
This is why we believe in revisions instead of partial grades - this way, you show us how you
can master it, we don’t guess how close you are to mastery.
1This is because you will be allowed to resubmit problems that are not correct and complete.
1
MAT301 Winter 2024 Prof. Mayes-Tang
Revisions
Generally, Explore problems will NOT be eligible for resubmission. Exceptions to this policy
will be announced during the term.
We will accept revisions to a limited number of problems on a posted schedule (TBA ac-
cording to TA scheduling).
Academic Integrity
There will be a student contract outlining the “rules of engagement” that must be submitted
prior to or along with the homework problems. It is consistent with the rules outlined during
the first day of class and on the syllabus.2
1 Week 1 (due 10 a.m. on January 16)
These problems do not need to be prdai 写MAT301、Python/Java epared in LATEX. You can draw the images required for
this problem set.
Along with your first homework, you must submit the Student Contract.3
1. Explore: Frieze Patterns As a (very large!) class, you will build a database of frieze
patterns across campus. A question you will answer is: what is the most common type
of frieze pattern? Is there a most common type of frieze pattern in modern buidings
vs. older buildings?
a) Take pictures of frieze patterns across campus (Make sure that you record where
you’ve found the patterns). Find four of them from different buildings across the
UofT campus that have four different symmetry groups. Write down the sets
underlying their symmetry groups (that is, the symmetry actions for each frieze
group)
b) Sketch the Cayley diagrams of each frieze pattern.
c) Enter your frieze pattern and its information into your section’s spreadsheet.4 On
the assignment page, give the ID number of the entry.
2. Proof: Symmetry groups of regular n-gons
2As of January 9 it is not yet prepared. But it will be very similar to Dana Ernst’s contract https:
3Undecided if it will be required every week, or only some weeks.
4We’ll provide a basic link to the spreadsheet on the course website on the weekend, and you can build
it out. If someone has already entered your frieze pattern but you have conflicting information on it, make
a new row and indicate that it is a conflict under a “conflict” column. If someone has already entered your
frieze pattern and you have the same information, just enter your name at the end of the row.
2 ?No copying, sharing, or posting without written permission
MAT301 Winter 2024 Prof. Mayes-Tang
(a) Based upon all of the investigations you have done, make a conjecture about how
many actions will be in the symmetry group of the regular n-gon, if n is an integer
greater than 1.
(b) Write a paragraph giving as convincing an argument as you can in favor of your
conjecture. Try to anticipate the counterarguments of a skeptical reader         

2D Pose人体关键点实时检测是一个非常热门的研究领域,广泛应用于动作捕捉、虚拟现实、运动分析等领域。以下我将分别介绍如何在Python、Android和C++中实现2D Pose人体关键点实时检测的Demo。 ### Python Demo 我们可以使用OpenPose库来实现2D Pose人体关键点实时检测。 首先安装OpenPose: ```bash pip install git+https://github.com/CMU-Perceptual-Computing-Lab/openpose.git@master ``` 然后可以使用如下代码进行实时检测: ```python import cv2 from openpose import pyopenpose as op # 配置参数 params = dict() params["model_folder"] = "models/" # 启动OpenPose opWrapper = op.WrapperPython() opWrapper.configure(params) opWrapper.start() # 打开摄像头 cap = cv2.VideoCapture(0) while True: ret, frame = cap.read() if not ret: break # 处理图像 datum = op.Datum() datum.cvInputData = frame opWrapper.emplaceAndPop([datum]) # 显示结果 cv2.imshow("OpenPose", datum.cvOutputData) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows() ``` 上述代码中我们首先配置了OpenPose的参数,启动了OpenPose,然后打开了摄像头进行实时的人体关键点检测,并将结果显示出来。 ### Android Demo 在Android上我们可以使用TensorFlow Lite提供的PoseNet模型。 首先添加依赖: ```gradle implementation 'org.tensorflow:tensorflow-lite-support:0.1.0' ``` 然后可以使用如下代码进行实时检测: ```java // 初始化PoseNet Interpreter interpreter = new Interpreter(loadModelFile(context)); Camera camera = Camera.open(); camera.setPreviewCallback(new Camera.PreviewCallback() { @Override public void onPreviewFrame(byte[] data, Camera camera) { // 将数据转换为Bitmap Bitmap bitmap = convertYUV420ToBitmap(data); // 使用PoseNet进行检测 float[][][] heatmaps = detectPose(interpreter, bitmap); // 绘制关键点 Canvas canvas = new Canvas(bitmap); drawKeypoints(canvas, heatmaps); // 显示结果 ImageView imageView = findViewById(R.id.imageView); imageView.setImageBitmap(bitmap); } }); ``` ### C++ Demo 在C++中我们可以使用OpenCV和DL libraries如TensorFlow或Caffe。 首先安装必要的库: ```bash sudo apt-get install libopencv-dev ``` 然后可以使用如下代码进行实时检测: ```cpp #include <opencv2/opencv.hpp> #include <dnn.h> int main() { // 加载模型 cv::dnn::Net net = cv::dnn::readNetFromTensorflow("graph_opt.pb"); // 打开摄像头 cv::VideoCapture cap(0); while (true) { cv::Mat frame; cap >> frame; // 准备输入 cv::Mat inputBlob = cv::dnn::blobFromImage(frame, 1.0 / 255.0, cv::Size(368, 368), cv::Scalar(0, 0, 0), true, false); net.setInput(inputBlob); // 进行推理 cv::Mat output = net.forward(); // 绘制关键点 std::vector<cv::Point> keypoints = getKeypoints(output); drawKeypoints(frame, keypoints); // 显示结果 cv::imshow("OpenPose", frame); if (cv::waitKey(1) == 27) break; } return 0; } ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值