Midterm 1 (2021)
Assignment Rules and Execution
The first midterm covers the basic pattern recognition
techniques introduced up to Lecture 3. To pass the midterm you should
- perform one (only one) of the assignments described in the following;
- prepare the short presentation describing your results and upload it here by the (strict) deadline;
- give your short presentation in front of the class on the midterm date:
30 March 2021 - h. 13.30-16.00 (On the course Team)
You can use library functions to perform the analysis (e.g.
to do the DFT, to perform ncut clustering, etc.) unless explicitly indicated
(e.g. as in Assignment 6). You can use whatever programming language you like,
but I strongly suggest to use either Python or Matlab for which you have coding
examples.
The midterm presentation MUST take a maximum of 3 minutes and should include a maximum of 5 slides, whose content should cover:
- A title slide with the assignment number and
your name
- A slide with code snippets highlighting the key
aspects of your code
- Slides showing the results of the analysis
- A final slide with your personal considerations (fun things, weak aspects, possible ways to enhance the analysis, etc.).
Don’t waste slides and time to describe the dataset or the assignment you are solving as we will all be already informed on it.
List of Midterm Assignments
Signal processing assignments
All the signal processing assignments require to use the
following dataset:
https://archive.ics.uci.edu/ml/datasets/Appliances+energy+prediction#
Assignment 1
Perform an autoregressive analysis of the “Appliances” column of the dataset which measures the energy consumption of appliances across a period of 4.5 months. Fit an autoregressive model on the first 3 months of data and estimate performance on the remaining 1.5 months. Remember to update the autoregressive model as you progress through the 1.5 testing months. For instance, if you have trained the model until time T, use it to predict at time T+1. Then to predict at time T+2 retrain the model using data until time T+1. And so on. You might also try and experimenting with less "computationally heavy" retraining schedule (e.g. retrain only "when necessary"). Try out different configurations of the autoregressive model (e.g. experiment with AR models of order 3, 5 and 7). You can use the autoregressive model of your choice (AR, ARMA, ...) and perform data pre-processing operations, if you wish (not compulsory).
Hint: in Python, use the ARIMA class of the statsmodels library (set order=(3,0,0) for an AR of order 3); in Matlab you can use the ar function to fit the model and the forecast function to test.
Assignment 2
Perform a correlation analysis on the temperature data in the dataset (i.e. the columns marked as Ti). It is sufficient to pick up just one of the 10 sensors and show the cross-correlation plot against the remaining 9 sensors (make a plot for each of the sensors, but try to put 4/5 of them in the same slide in a readable form).
Assignment 3
The autocorrelation is useful for finding repeated patterns in a
signal.
For example, at short lags, the autocorrelation can tell us something
about the signal's fundamental frequency (i.e. the pitch). Implement a
very simple pitch detector from music signals using the autocorrelation
function. Following up this reference article (Section 2.A):
The
‘‘autocorrelation method’’chooses the highest non-zero-lag peak by
exhaustive search within a range of lags. Obviously if the lower
limit is too close to zero, the algorithm may erroneously
choose the zero-lag peak.
So basically you need to
find the lag corresponding to the maximum in the autocorrelogram,
avioding to pick up the trivial lag 0. Given a signal sampled at
frequency \( F_s \) and the maximum lag being \( \tau \) the
corresponding pitch is \( F_s \div \tau \).
To complete the assignment apply the analysis above to (at least) one of the WAVs in this repository. In Python you can import WAVs (and acces several other music-related functions), using the LibROSA library.
Image processing assignments
All the image processing assignments require to use the following dataset:
The dataset includes original images as well as their semantic segmentation in 9 object classes (i.e. the image files whose name ends in “_GT”, where each pixel has a value which is the identifier of the semantic class associated to it).
Assignment 4
Perform image segmentation on one of the eight image thematic subsets. Note that each file has a name starting with a number from 1 to 8, which indicates the thematic subset, followed by the rest of the file name. I suggest to use image subsets “1_*” or “2_*”. Use the normalized cut algorithm to perform image segmentation. You are welcome to confront the result with kmeans segmentation algorithm if you wish.
Hint: in Python, you have an NCut implementation in the scikit-image library; in Matlab, you can use the original NCut implementation here.
Assignment 5
Select one image from each of the eight thematic subsets
(see previous assignment), for a total of 8 images. Extract the SIFT
descriptors for the 8 images using the visual feature detector embedded
in SIFT
to identify the points of interest. Show the resulting points of
interest overlapped
on the image. Then provide a confrontation between two SIFT descriptors
showing completely different information
(e.g. a
SIFT descriptor from a face portion Vs a SIFT descriptor from a tree
image). The confrontation can be simply visual: for instance you can
plot the two SIFT descriptors closeby as barplots (remember that SIFTs
are histograms). But you are free to pick-up any reasonable means of
confronting the descriptors (even quantitatively, if you whish).
Assignment 6
Implement the convolution of a set of edge detection filters with an image and apply it to one face image and one tree image of your choice from the dataset. Implement Roberts, Prewitt and Sobel filters (see here, Section 5.2, for a reference) and compare the results (it is sufficient to do it visually). You should not use the library functions for performing the convolution or to generate the Sobel filter. Implement your own and show the code!