# Discussion for quizzes in article: Hands on with Deep Learning – Solution for Age Detection Practice Problem

1 Like

Hi @jalFaizy,

Can you please post solution with highest accuracy so that we all could learn from it.

I tried many architectures but was not able to get as much accuracy.

Thanks,

1 Like

here we have used the Stochastic gradient descent optimizer (i.e optimizer =‘sgd’). did any one tried using (optimizer =‘adam’) i believe Adam is also a Stochastic Optimization algorithm. I have seen people using ‘adam’ algorithm which is yielding better results

1 Like
``````# Python 3 code to randomly load an image into jupyter notebook and print it and open it

import os, random

image_folder=r'C:\Users\User\Documents\ImagesFolder'

a=random.choice(os.listdir(image_folder))
print(a)

from PIL import Image
file = image_folder+'\\'+a
Image.open(file).show()``````

This is the simplest way I can use matplotlib to solve the problem:

``````import matplotlib.pyplot as plt
from random import randint
img_name = randint(0, 26542)
img = plt.imread("C:\\Users\\User\\Age Detection\\Dataset\\Train\\Train\\" + str(img_name) + ".JPG")
plt.imshow(img)``````