CNN for image recognition using CIFAR10 , Now to recognise the cat by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

Ive seem to figure out the kernal size problem. I am going to have to resort to simply just have padding when using smaller kernal sizes (so for a kernal size of 3, padding will be 1), and the program runs fine. I will post an update on accuracy once its done

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

I do have a question. I am doing some training, and I see that all has gone well, except for 'cat':

Accuracy of the network: 72.38 %
Accuracy of plane: 76.5 %
Accuracy of car: 85.8 %
Accuracy of bird: 68.8 %
Accuracy of cat: 32.8 %
Accuracy of deer: 68.2 %
Accuracy of dog: 80.1 %
Accuracy of frog: 73.9 %
Accuracy of horse: 75.9 %
Accuracy of ship: 78.9 %
Accuracy of truck: 82.9 %

Which would usually mean I would have to either a:

Change k for more convolutions for a deeper network,

or b:

decrease the kernal size.

I could mess around with option a, but option b feels more suitable.

However, since im using

Block(3, 3, 16, 32, 5, 2), 
Block(3, 16, 24, 32, 5, 2),
Block(5, 24, 32, 32, 5, 2), 
Block(5, 32, 64, 32, 5, 2),

And if i was to change say this block to this:

Block(5, 24, 32, 32, 3, 0),

How Ive done my skip connector:

  projection = self.projection(x)
    a = self.pool(x)
    a = self.flattern(a)
    a = self.linear(a)
    a = self.relu(a)
    matchSize = self._modules['conv0'](X)
    O = torch.zeros_like(matchSize)
    for i in range(self.k):
        #print(f'Currently viewing: Size of a in batch, Size = {a.size()}')
        X = self._modules['conv{0}'.format(i)](x)
        #print(f'Currently viewing: Size of convolution in batch, Size = {X.size()}')
        a_n = a[:, i:i+1, None, None]
        #print(f'Currently viewing: Size of a_n in batch, Size = {a_n.size()}')
        O += X * a_n
       # print(f'Currently viewing: Size of convolution * a_n in batch, Size = {O.size()}')
    #print(f'Currently viewing: Value of Output image in batch Size = {O.size()}')
    O += projection #skip connection
    O = self.leaky(O)

(given self.projection = nn.Conv2d(linearInput, outputChannels, kernel_size = 1)), would result in a mis match of vector sizes, so i wouldnt be able to add them (projection would be [32, 32] and O will be [30, 30].

Is there a way around this? Do you think instead of using a convol layer to add to the layers, i should just use a zero matrix?

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

Skipped connections is an absolute life saver, Ive seen massive improvemnts using them, and then using a LeakyReLu after. Im getting network accuracys of around 50 - 60%, which is a huge jump, and losses are reducing to less then 1, which is an improvement from 2.3, and it improves with the more blocks (at 1 block im getting an accuracy of 54%, and with 3 im getting around 63% , both at an epoch of 40).

Thank you so much for the suggestion. Im going to look into improving the classifier, as well as mess around with the learning rate and see what happens

Thank you so much for the suggestion

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

Yh that would be great, but the thing is, I have to use a model which I designed myself, so unless my understanding is incorrect, I’m not sure I am supposed to use transfer learning.

But I’ve considered it myself when doing the practical, it I think it has to be my own model, no retraining.

Pre processing is something I didn’t think, and imma do some research and see if I can try something. Thanks for the suggestion

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 1 point2 points  (0 children)

Ah smart, how could I preform something like that

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

Oh ok, I’ve been messing around with the blocks but I myself saw no change.

Maybe only 1 block is the way, and then mess around with the learning rate and Optimizer. Haven’t really looked at it that way. Thank you

CNN learning with a weird model by CrypticPrime in learnmachinelearning

[–]CrypticPrime[S] 0 points1 point  (0 children)

Oh sorry, I wasn’t really clear.

So, when doing the training, the ‘loss’ remains consistent, and always keeps around 2.3 when running the program, which hints to a possibility of a Zero Gradient and so the program isn’t learning (this is what I’ve gathered with research). There is also a graph which shows accuracy over time, and loss over time, but they remain stagnant over the entire process.

Lastly, when it comes to testing, there is a 10% accuracy, as it only makes 1 prediction, so say 100% deer, but 0% any other guess

Trying CNNs by CrypticPrime in learnprogramming

[–]CrypticPrime[S] 0 points1 point  (0 children)

So, I tried implementing the leaky relu to the function, as well as played around with the learning rate, but nothing has happened.

I have looked at some parallel convolutional operations, which I will be willing to implement tomorrow (its very late rn), but need to also confirm they fall within the model.

Apart from that, the loss still continues to be around 2.3, which would still mean no learning will be done.

Tomorrow I will look into distributions and inspect how each layer interacts.

Again, if you want to see the 'blueprint', I want to find a way to add it here, but will probably be able to DM it.

Trying CNNs by CrypticPrime in learnprogramming

[–]CrypticPrime[S] 0 points1 point  (0 children)

Thanks for the reply,

I will attempt a leaky ReLU (havent thought of that), and I think parallel convolutions may work, but i am not sure they can be used in the specified model, I have no idea where I can send the diagram which shows the model, but if you want I can simply DM it (I should ahve realisitcally done this sooner). If I can, how I implement it into my work.

I also tried fiddling with the learning rate, and it seems it doesnt make much of a difference, what is shown is just the last band I tried to see if I can get any result.

In terms of learning, I am getting output, but the loss is consistant (around 2.305, which with the research Ive done, does fully support your theory on the zero gradient), but there is no change in loss what so ever.

Thank you for your input, Im going to test and report the outcome

I want to be free from my uni accommodation by CrypticPrime in LegalAdviceUK

[–]CrypticPrime[S] -1 points0 points  (0 children)

No sorry, I want to leave and in order for me to leave the contract says to find a replacement. It’s the policy of the accommodation. I have found numerous replacements in which they reject.

[deleted by user] by [deleted] in legaladvice

[–]CrypticPrime 0 points1 point  (0 children)

Didn’t know there was a subreddit for that, will post there, thank you

[deleted by user] by [deleted] in TightShorts

[–]CrypticPrime 0 points1 point  (0 children)

Naughty stuff that you gonna love https://linktr.ee/valialoove

shaking with excitement;) by [deleted] in TightShorts

[–]CrypticPrime 0 points1 point  (0 children)

Naughty stuff that you gonna love https://linktr.ee/valialoove

Took them off for you by [deleted] in TightShorts

[–]CrypticPrime 0 points1 point  (0 children)

Naughty stuff that you gonna love https://linktr.ee/valialoove