COMP 0137 Machine Vision: Homework #1
Due 19th
November 2018 at 23:55pm
Worth 10% of your overall grade
Submit online, through Moodle
For this homework, we’ll revisit the practical from the 3rd
week: Mixtures of Gaussians.
There are two parts (plus optional extra credit), so please read the instructions carefully.
Everything you turn in must be YOUR OWN WORK, with one exception (in this case): the
new images and their ground truth mask images. See below for more details, but as always,
list names/references for anything you’re submitting that is not your own work.
Late Policy: We must follow the official UCL late-policy, and this gets applied *after* your
coursework is marked on Moodle, based on the Moodle timestamps. The instructor/TA’s
have no control over this – at all:
https://www.ucl.ac.uk/academic-manual/chapters/chapter-4-assessment-framework-taught-progra
mmes/section-3-module-assessment
What to turn in (all inside one folder, zip’ed inside a single .zip file):
- Three jupyter notebooks: for practicalMixGaussA.ipynb; also for B and C, but not D.
- Your jupyter notebook for practicalMixGauss_Apples.ipynb
- One folder containing your photos of apples
- One folder containing image masks for your apples
Code/Hints: All code must be python, submitted as jupyter python notebook files (.ipynb),
with your explanations interspersed within the notebooks. Do not use other libraries beyond:
os, time, sys, numpy, matplotlip, scipy.io, glob, and pillow and/or opencv if you need it.
Please use Python 3.6.
Part I: A), B), C)
Do all the TO DO’s in parts A, B, and C of the Mixtures of Gaussians practical. Some of the
TO DO’s are tagged a-j.
For every figure or plot that is generated in the code, write 1-3 sentences (maximum)
explaining what the figure shows or pros/cons of what is happening, good or bad.
It IS NOT SUFFICIENT to just say things like "update the variable." Ok, some things are
deterministic, but explain, to demonstrate you understand why those steps are happening.
Examples of things to talk about, in the 1-3 sentences:
- Give some analysis about code working/not working out, especially when stochastic.
- Discuss where/which results don’t match your expectations. Why? Be specific.
- Describe what EACH figure or plot is showing, what it would look like ideally.
- Discuss ways some step or experiment could be better / more robust. Validating your
process means being thorough, and what would you need to be more thorough?
You do NOT need to do the 4th
part, practicalMixGaussD.
Part II Make a new file, practicalMixGauss_Apples.ipynb.
A) Download and unzip the file apples.zip. Notice that for every color photo containing
apples, there is a corresponding binary image mask. In a mask image, white pixels indicate
(continued on next page…)
locations where the corresponding photo is an apple. In floating point, you may need to
threshold to get binary values. Note that these mask images are inexact! While a perfect
ground-truth mask image’s black pixels should correspond to non-apples, these masks were
painted in a hurry, so the white areas were painted conservatively.
# You may want to use this example code, for loading in your
jpg’s and png’s:
import glob
import numpy as np
import matplotlib.pyplot as plt
files = glob.glob("apples/*.jpg")
ColorImgs = []
for myFile in files:
im = plt.imread(myFile)
ColorImgs.append(im)
B) Train a mixture of Gaussians model for distinguishing apple vs. non-apple pixels. Use red,
green, and blue as your dimensions for now. Make any other decisions you need to, and
document them in your jupyter notebook.
C) Download the file testApples.zip. Generate figures for your notebook, showing each
pixel’s posterior probability of being “apple.” Comment on the outcomes.
D) For the test image with a ground-truth mask, quantify and report your result. Hint:
consider applying a range of thresholds to the posterior to produce sets of {True Positives
(TP), True Negatives (TN), False Positives (FP), and False Negatives (FN)} and using an
ROC curve. Learn about ROC on Wikipedia or see Peter Flach’s chapter on the subject.
E) Download two non-copyrighted photos with apples (maybe
http://search.creativecommons.org/ or some other source of images that are not copyrighted).
Make good ground-truth masks for them. You can use Windows Paint, or more sophisticated
programs like Gimp (free). Use these as extra test-images. Report your qualitative and
quantitative results.
F) We should really be using three separate sets of files: a training set, a validation set, and a
test set! Explain why.
Extra Credit: Put this section at the end of the practicalMixGauss_Apples.ipynb notebook
(extra points help you reach a perfect score for the two courseworks only, so a maximum of
20% of the overall grade).
- Consider manipulating the photographs’ colors to improve the classification
- Consider running 2D Gabor filters on the photos to get additional channels of data, in
place or in addition to red, green, and blue.
- Consider using an alternate model to mixture of Gaussians, and compare to MoG.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。