cs231n | My solutions to cs231n course
kandi X-RAY | cs231n Summary
kandi X-RAY | cs231n Summary
This folder contatins my solutions to CS231n assignments (
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cs231n
cs231n Key Features
cs231n Examples and Code Snippets
Community Discussions
Trending Discussions on cs231n
QUESTION
I am trying to code a ResNet CNN architecture based on the paper by using Python3, TensorFlow2 and CIFAR-10 dataset. You can access the Jupyter notebook here.
During training the model using "model.fit()", after just one epoch of training, I get the following error:
ValueError: Input 0 is incompatible with layer model: expected shape=(None, 32, 32, 3), found shape=(32, 32, 3)
The training images are batched using batch_size = 128, hence the training loop gives the following 4-d tensor which TF Conv2D expects- (128, 32, 32, 3).
What's the source of this error?
...ANSWER
Answered 2021-Mar-05 at 19:48Ok, I found a small issue in your code. The problem occurs in the test data set. You forget to transform it properly. So currently you have like this
QUESTION
This might come across as a seriously newbie question, but I have not many options as I am not sure which direction I should be heading.
Now I am studying Deep Learning frequently and I want to toy around with Stanford's CS231N's Convolutional Neural Network Demo as I find it extremely user friendly. The visuals are embedded in this website. I really want to toy around with this but I do not know how and where to start.
I have knowledge of Python and VS-Code if that helps.
...ANSWER
Answered 2021-Jan-28 at 08:05Take the index.html file from the above link.
If you look closely in index.html, there are two scripts you need that to make it work.
Copy the files from the demo folder from the link and the files structure should look like this(same as in the github demo)
Now double click on index.html and choose a browser to open this work and should work as expected. And you can also modify the code and reload the index.html to see live changes.
QUESTION
I'm trying to do it by myself the assignments from Stanford CS231n 2017 CNN course.
I'm trying to compute L2 distance using only matrix multiplication and sum broadcasting with Numpy. L2 distance is:
And I think I can do it if I use this formula:
The following code shows three methods to compute L2 distance. If I compare the output from the method compute_distances_two_loops
with the output from method compute_distances_one_loop
, both are equals. But I compare the output from the method compute_distances_two_loops
with the output from the method compute_distances_no_loops
, where I have implemented the L2 distance using only matrix multiplication and sum broadcasting, they are different.
ANSWER
Answered 2020-Nov-22 at 09:51I think that you are looking for the pairwise distance.
There is an amazing trick to do that in a single line. You have to cleverly play with the boradcasting:
QUESTION
I have decided to complete cs231 course and do its assignment. I happily watched the first 2 videos of the course and now I had to solve the first assignments. I followed the guidelines step by step which was shown in the video in this link: https://cs231n.github.io/setup-instructions/ Then, when I run the first cell, which is not the cell shown in the video but nonetheless it's in the assignments1 file which I downloaded from their site, I get a nasty error which has paralyzed me four a couple of hours. I'd be happy if anyone could respond. IF you take a look at my picture, you'll see that files are added in the google drive, but surprisingly, it gives an error out of nowhere. Thanks.
===========================================================================
Update: Here is the snapshot of the video provided to guide students how to setup their google colab (in that link).
As you can see, in their vide the first chunk of code specifies their working directory but in the file that they have uploaded as their assignment1, they have not done so!
...ANSWER
Answered 2020-Aug-01 at 13:17cs231n is a virtual environment according to documentation from the link u provided.
Every time you want to work on assignment you should activate that environment by source ~/cs231n/bin/activate
QUESTION
In the following code written by Karpathy, why do we have this line(Why do we need to compare with the uniform distribution to select an action while the policy function did that)
...ANSWER
Answered 2020-Jul-19 at 15:52Without the uniform comparison, the policy would be deterministic. For any given state, the policy_forward
function will return the same output, so the same action will be taken every time. So there won't be any exploration of you use your proposed method. The uniform introduces some stochasticity into thr action selection, which encourages exploration. Without exploration it's essentially impossible to discover the optimal policy.
QUESTION
I'm going through CS231n to understand the basics of neural networks.
Attached is the slide in which Justin (the tutor) gives the reasoning for why data preprocessing is required and I don't completely understand. The explanation given is similar to the one given on the slide and I don't get it. The slide is below.
The second question I have is: is it actually normalisation or standardisation? This link implies that it is standardisation, whereas the course material says it is normalisation.
Any help will be appreciated.
...ANSWER
Answered 2020-May-21 at 07:29A) The meaning of "less sensitive to small changes in weights" can easily be visualized. Imagine to operate a little change in the weights of the drawn hyperplane, i.e. rotate it a bit. If the samples are located around the origin, you'll notice that they can still be correctly classified. If they're far away from the origin, the same little change in weights will lead to bigger misclassifications.
B) Sometimes standardization and normalization are used interchangeably.
Standardization: I quote from Machine Learning and Pattern Recognition by Bishop : "For the purposes of this example, we have made a linear re-scaling of the data, known as standardizing, such that each of the variables has zero mean and unit standard deviation."
Normalization could be e.g. min-max normalization when you scale all feature values to the [0,1] range, or feature vector normalization when you divide the feature vector by its modulus.
QUESTION
Does Eigen support getting next block with stride =2?
I observed the default behavior is with stride =1 in this:
...ANSWER
Answered 2020-Mar-09 at 05:05You can declare the stride with Eigen::Map
as such:
QUESTION
I run into this problem when implementing the vectorized svm gradient for cs231n assignment1. here is an example:
...ANSWER
Answered 2020-Feb-10 at 18:59Using built-in np.add.at
The built-in is np.add.at
for such tasks, i,e.
QUESTION
I'm trying to use scipy
's ndimage.convolve
function to perform a convolution on a 3 dimensional image (RGB, width, height).
Taking a look here:
It is clear to see that for any input, each kernel/filter should only ever have an output of NxN, with strictly a depth of 1.
This is a problem with scipy
, as when you do ndimage.convolve
with an input of size (3, 5, 5)
and a filter/kernel of size (3, 3, 3)
, the result of this operation produces an output size of (3, 5, 5)
, clearly not summing the different channels.
Is there a way to force this summation without manually doing so? I try to do as little in base python as possible, as a lot of external libraries are written in c++ and do the same operations faster. Or is there an alternative?
...ANSWER
Answered 2020-Jan-17 at 17:21No scipy doesn't skip the summation of channels. The reason why you get a (3, 5, 5)
output is because ndimage.convolve
is padding the input array along all the axes and then performs convolution in the "same" mode (i.e. the output has the same shape as input, centered with respect to the output of the "full" mode correlation). See the scipy.signal.convolve for more detail on modes.
For your input of shape (3 ,5, 5)
and filter w0
of shape (3, 3, 3)
, the input is padded resulting in a (7, 9, 9)
array. See below (for simplicity I use constant padding with 0's):
QUESTION
Let's say input to intermediate CNN layer is of size 512×512×128 and that in the convolutional layer we apply 48 7×7 filters at stride 2 with no padding. I want to know what is the size of the resulting activation map?
I checked some previous posts (e.g., here or here) to point to this Stanford course page. And the formula given there is (W − F + 2P)/S + 1 = (512 - 7)/2 + 1, which would imply that this set up is not possible, as the value we get is not an integer.
However if I run the following snippet in Python 2.7, the code seems to suggest that the size of activation map was computed via (512 - 6)/2, which makes sense but does not match the formula above:
...ANSWER
Answered 2019-Dec-16 at 08:14Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cs231n
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page