Wiki: Lesson 7

Hey guys. I recently completed part 1 and set out to build and image classifier for distinguishing between minerals.
I have written my first medium post based on it, please check it out and comment on it, thanks

In Resnet and Resnet2 sections, I can not find relu activation. This is a mistake?

@jeremy Tried generating text using twitter twits got the below,

#d? am a cant can an inscan!!! day. i guess i feel in back to get up and i could see the lage.-- didn’t see and heaud crack. i mide sick i try #imisscath #imisscathmy meat tonight! cook bandople is over but it up’s gonna cry! how bum can i just want a really dound inch day!! failing you me. cr�i 43 droin-and has anyone? bethene of exaisie love stuck (moment today, but i did not wait to fmlm 106 good. dont twits my 25 must meee who win stmle’ school more has getting tating of a brackbengs until days i am tumblr. on my p2y fizzley. =9 (. sad .remboison, http://www.nichamai today is be tomorrow? @:: of wirent os was baby left him a finally bank he doesn’t even complythan made my feetssic day. bummed out nite was picked winnin david? always missed chica texting no crew tomorrow. *pa3. because off? brace for teachers pab jul- 40 10y is off some tomorrow. always i lost the summer. http://twitpic.com/67munfl days soco cavs like it for this tumblr . , http://bit.ly/1w1yzs5 @donton content

Kind of funny it tried to create its own emoji =9 and some url and #tags

At 29:58, when Jeremy defines the n_hidden = 256, is 256 like an industry standard? How do I determine how many hidden layers I need?

Awesome Shubham. Thanks for the sharing.

no relus are inside the bnlayers

Hi,

I can’t reproduce the stats that describe the mean and standard deviation per channel for CIFAR-10 as described at the start of the CNN from scratch segment.

classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
stats = (np.array([ 0.4914 ,  0.48216,  0.44653]), np.array([ 0.24703,  0.24349,  0.26159]))

# verify 
train_images = [img_as_float(io.imread(file)) for file in glob("/home/nebfield/data/cifar10/train/*/*.png")]

imgs = [] 
for img in train_images:
    imgs.append([img[:, :, i].mean(dtype=np.float64) for i in range(img.shape[-1])])
mpc = np.array(imgs)
mpc.mean(axis=0) # OK

array([0.4914 , 0.48216, 0.44653])

mpc.std(axis=0) # weird. double check this

array([0.12836, 0.12579, 0.15332])

I can’t figure what I’m doing wrong! (probably something stupid)

@nebfield Did you ever figure this out?

Yes, here’s some code that succesfully reproduces it:

train_images = [img_as_float(io.imread(file)) for file in glob("train/*/*.png")]

r = []
g = []
b = []

for img in train_images:
    r.append(np.reshape(img[:,:,0], -1)) # R reshape returns 1D array red channel
    g.append(np.reshape(img[:,:,1], -1)) # G
    b.append(np.reshape(img[:,:,2], -1))# B
    
r, g, b = np.array(r), np.array(g), np.array(b)

print('means: {} {} {}'.format(np.round(r.mean(), 5), np.round(g.mean(), 5), np.round(b.mean(), 5)))
print('stdev: {} {} {}'.format(np.round(r.std(), 5), np.round(g.std(), 5), np.round(b.std(), 5)))

Awesome. Thanks for this. I’ll check it out and give it a shot.

Hello. I wrote some code to classify and move the CIFAR10 data into classification folders, as required for lesson7-cifar10 to work. I would love to share it but I’m not sure the best way to do that. Please let me know if I can contribute to the Lesson codebase git hub, or if I should post to this forum or something else. Thanks!

Folks, having a conceptual question around Feature Loss (lesson as of minutes 1:18:37).

I (kind of) get the technicalities of comparing intermediate layers to make sure the cat’s eyeball is really properly (similar to target) represented with details. Intuitively seems like a lens to put focus on an area.

What I do not get: who decides that the generator has to focus on e.g. eyeballs? Is that us as humans in saying, ‘well cats really need nice eyeballs’ or is the model somehow figuring out that really matters to us? Quite a thing, if a model could somehow know for human judgement on quality of a pic eyeballs matter. Sounds a little too magic to me and likely this question documents I didn’t focus well enough on some of Jeremy’s explanations or parts of the code :slight_smile:

Still, hoping that question makes sense and I havent overlooked a previous discussion on it.

thx