EECS 442: Computer Vision (Fall 2019)The goal of this assignment is to incentivize learning to write reasonably good python/numpy code. This is so that:
A great gentle introduction to python and Numpy from Justin Johnson is here Numpy Tutorial. The Mastery AssignmentSee homework here: resources/mastery_assignment.zip. Each assignment requires you to fill in the blank in a function (in tests.py and warmup.py) and return the value described in the comment for the function. The code will start with: def sample1(L): #Given: # a list L #Return: # the 1st entry of L (counting like humans, not computers) #Hint: No hints for you return None You can then fill in: def sample1(L): #Given: # a list L #Return: # the 1st entry of L (counting like humans, not computers) #Hint: No hints for you return L[0] You can test your implementation by running the test script. python run.py --test b1 #Test problem b1 python run.py --allwarmups #Test all the warmup problems python run.py --alltests #Test all the test problems python run.py --alltests --pdb #Test all the test problems, and launch the #pdb debugger if things don't match so you #can find the differences This will show: $ python run.py --allwarmups Running b1 Running b2 ... Running b20 Ran warmup tests 20/20 = 100.0 Warmup ProblemsYou need to solve all 20 warmup problems (in warmup.py). These are all solvable in one line. TestsYou need to solve any 15 of the 20 problems (in tests.py). Many are not solvable in one line. Only one (p10) should be done with a for loop. You are free to choose any 15 that you want but you are highly encouraged to do all 20. It may pay off to know how to do: p2, p11, p12, p14, and one of (p18, p19, p20) Here is one example: def p4(t): #Given: # a tuple of 3x3 rotation matrix R # Nx3 matrix M #Return: # a Nx3 matrix of the rotated vectors #Par: 3 lines #Instructor: 1 line #Hint: # 1) Applying a rotation to a vector is right-multiplying the rotation # matrix with the vector # 2) .T transposes; this may make your life easier # 3) np.dot matrix-multiplies R, M = t #unpack return None For each, we provide:
What to submitSubmit a pdf of:
You can submit as many times as you need in order to get 100%. |