cs231n | My solutions to cs231n course

 by   adambielski HTML Version: Current License: No License

kandi X-RAY | cs231n Summary

kandi X-RAY | cs231n Summary

cs231n is a HTML library. cs231n has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

This folder contatins my solutions to CS231n assignments (
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              cs231n has a low active ecosystem.
              It has 5 star(s) with 2 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              cs231n has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of cs231n is current.

            kandi-Quality Quality

              cs231n has no bugs reported.

            kandi-Security Security

              cs231n has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              cs231n does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              cs231n releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cs231n
            Get all kandi verified functions for this library.

            cs231n Key Features

            No Key Features are available at this moment for cs231n.

            cs231n Examples and Code Snippets

            No Code Snippets are available at this moment for cs231n.

            Community Discussions

            QUESTION

            ValueError: TensorFlow2 Input 0 is incompatible with layer model
            Asked 2021-Mar-05 at 19:48

            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:48

            Ok, 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

            Source https://stackoverflow.com/questions/66496888

            QUESTION

            How do I load this html file for my own visualization?
            Asked 2021-Jan-28 at 08:05

            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:05

            Take 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.

            Source https://stackoverflow.com/questions/65932647

            QUESTION

            Compute L2 distance with numpy using matrix multiplication
            Asked 2020-Nov-26 at 10:42

            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:51

            I 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:

            Source https://stackoverflow.com/questions/64952027

            QUESTION

            ModuleNotFoundError in python in cs231 course
            Asked 2020-Aug-01 at 18:57

            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:17

            cs231n 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

            Source https://stackoverflow.com/questions/63205002

            QUESTION

            Why do we need to compare with the uniform distribution to select an action while the policy function did that in Deep RL
            Asked 2020-Jul-19 at 15:52

            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:52

            Without 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.

            Source https://stackoverflow.com/questions/62982340

            QUESTION

            Intuition behind data preprocessing in ML
            Asked 2020-May-21 at 07:29

            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:29

            A) 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.

            Source https://stackoverflow.com/questions/61928582

            QUESTION

            eigen: get next block of the matrix with stride =2
            Asked 2020-Mar-10 at 06:29

            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:05

            You can declare the stride with Eigen::Map as such:

            Source https://stackoverflow.com/questions/60594458

            QUESTION

            numpy vectorized way to change multiple rows of array(rows can be repeated)
            Asked 2020-Feb-10 at 18:59

            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:59

            Using built-in np.add.at

            The built-in is np.add.at for such tasks, i,e.

            Source https://stackoverflow.com/questions/47954010

            QUESTION

            Scipy ndimage.convolve skips the summation of channels
            Asked 2020-Jan-22 at 04:47

            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:21

            No 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):

            Source https://stackoverflow.com/questions/59782158

            QUESTION

            Constraint on dimensions of activation/feature map in convolutional network
            Asked 2019-Dec-16 at 08:14

            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:14

            Here is the formula being used in pytorch: conv2d(go to the shape section)

            Also, as far as I know, this is the best tutorial on this subject.

            Bonus: here is a neat visualizer for conv calculations.

            Source https://stackoverflow.com/questions/59352314

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install cs231n

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/adambielski/cs231n.git

          • CLI

            gh repo clone adambielski/cs231n

          • sshUrl

            git@github.com:adambielski/cs231n.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link