0% found this document useful (0 votes)
4 views2 pages

Homework2

Uploaded by

emirkan.b.yilmaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Homework2

Uploaded by

emirkan.b.yilmaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSE655 – Deep Learning (Spring 2025)

Homework #2
Hand-in Policy: Via Teams. Late submission rules are given in the course syllabus.
Collaboration Policy: You are expected to do your own work. No collaboration is permitted.
Grading: This homework will be graded on the scale 100.

Description: Experiments with CNNs.


You are expected to use the Python language and the Keras library unless otherwise noted. You will
prepare a report including your code and results (in a Jupyter Notebook). The report format is shown
at the end of this document.
Part 1: Digit recognition using CNNs
You are asked to train a feed forward network to recognize handwritten digits. Use the MNIST data
commonly available on the internet.
1. Read your data.
2. Construct a CNN-based network that best fits the data with good generalization on the test
data.
3. Report the training and test performances of your trained final model.
You may want to start with the previous homework for this. Do not use one of the existing networks.
The complexity of the model should be a bit higher than AlexNet.
Part 2: Input optimization for a CNN
In this part, you will use the model you have trained in the previous part. Your aim is to find the best
input image to generate a given output.
1. Read your data.
2. Load your model from the first part.
3. For the output [0,0,1,0,0,0,0,0,0,0] (i.e., digit 1):
a. Create a random image (your image should be gray scale with values from 0 to 1, i.e.,
normalized).
b. Feed the random image to the model.
c. Try to minimize the error in the output by continuously updating the input image using
gradient descent. For this you need to write a proper loss function along with some
constraints for regularization (image pixel values to stay within the interval [0,1]).
d. Report the best image found for this. Try this for a few iterations of the random image
to see how the optimization is affected by the initial choice of the image.
e. Try again this time using an actual image of the digit with noise added as the initial
image. Report the results.
4. Try the previous step for:
a. All the other digits. For example, for 8 your output is [0,0,0,0,0,0,0,0,1,0].
b. Set the output to [0,0,0.5,0.5,0,0,0,0,0,0] meaning something between digits 2 and 3.
c. Run your optimization and report the best image generating this output. You are
expected to address initialization and other potential problems with your
minimization algorithm.
What to hand in: You are expected to hand in the following
• Homework2_StudentNumber_LastName_FirstName.ipynb (the Python Jupyter Notebook
used to obtain the result provided in the report). You MUST follow this convention of
submission file naming as some of your identities cannot be determined from your Teams
profiles.

Report format should be something like the following:


Part 1: Digit recognition using CNNs
Code:

Results:

Comments:

Part 2: Input optimization for a CNN


Code:

Results:

Comments:

You might also like