Labeeb Asari
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ## Neural Networks - Our Journey in Making Computers Smart Artificial Intelligence, Machine Learning, Deep Learning have been the biggest tech buzzwords for the past few years. With our computers getting faster and more efficient, it is only obvious that we would try to achieve the sci-fi dream of having a humanoid robot. While we are still quite a few years away from realizing that dream, Machine Learning has still achieved wonders today. Such an exciting field piqued our interest and we began working on a project to achieve style transfer using Neural Networks. ## Kickstart the Learning! The first step was very obvious for us - learn as much as you can. And our mentors had abundant resources prepared for us. Primarily we followed the Deep Learning Specialization taught by the ML Messiah - Andrew NG. Initially it was overwhelming, because we had to finish a major portion of the specialization to just understand and start working on our actual project + the time constraint. The course however provided a smooth learning experience, the best part of the course was its the assignments! Our initial goals was just to understand the different aspects of neural networks and learn to build them from scratch. This is where the assignments 10x'ed our learning. We struggled with our initial assignments and remember this meme on neural networks? We built one in our 1st week and it actually is gonna take over the world! <div> <img src="https://i.imgur.com/s77ngS5.png" width="300" height="300" > <img src="https://i.imgur.com/4gN3jND.png" width="400" height="300" > </div> <br> ## Shapes (10,7) and (4,7) not aligned *Forward prop is just Matrix multiplication.* It shouldn't be that hard right? When you start out writing you own neural nets, you'll most likely run into one of these ValueErrors - <img src="https://i.imgur.com/hkP0FQC.png" height="300" > its so common because, its hard to keep track of the dimensions of your weight matrix for each layer, and you cannot multiply incorrect dimensions. though it took alot of time to backtrack and resolve these errors, it made every step much more clear. ## Hello World program of Neural Networks When you start learning a programming language, the 1st thing you (must) do is print "Hello World!". Similarly, when you start learning Neural Nets, the 1st network you write is the one to identify handwritten digits! So after learning enough about neural networks we decided to write a hello world program but in neural nets language. We made a generalized Neural net, where you can chose the size(no. of layers and the activations in each layer) and feed it any dataset! For digit recognition we used the classical MNIST Handwritten digits. MNIST is a dataset of 60,000 small square 28×28 pixel grayscale images of handwritten single digits between 0 and 9. This particular excercise was a rather smooth sailing, all thanks to the wonderful assignments. While training we did get annoyed by how long it took (~30 minutes). Little did we know, how much worse it would get from now on. Upon training this model, we were able to achieve a train accuracy of 97% and a test accuracy of 95.5%. We built this model just an excercise to see if we could build a Neural Network model from scratch using Numpy. It is however important to note the the general consensus right now is that the MNIST dataset is not a reliable way to learn neural networks since it is very easy to train. Infact, a simple convolutional neural network can achieve 99.7% accuracy. It also might paint an unrealistic picture of how simple the field of deep learning can be. ## Put on the training wheels Now that we knew we can build a Neural Network from scratch, we made the process much easier for ourselves using Tensorflow. TensorFlow is a free and open-source software library for machine learning and artificial intelligence. It can be used across a range of tasks but has a particular focus on training and inference of deep neural networks. We began by creating another MNIST model using Tensorflow. The model which took hundreds of lines of code previously using Numpy, now took under 10 lines! It still feels like cheating. However, we couldn't have made our larger models from scratch since writing the code would have taken up too much time. So, Tensorflow was the way to go. ## Walking the Trodden Path We were in need for an accurate model. We could have spent time tinkering with our own model but instead decided to work with some published models. Some of the most notable architectures are: 1. LeNet 2. AlexNet 3. VGG Net 4. GoogLeNet 5. ResNEt 6. ZFNet We mostly tried AlexNet and VGGNet since they fit our requirements. Since AlexNet and VGGNet are very deep networks, we trained both of these models on the CIFAR-10 dataset to learn more about these architectures. ## Neural Style Transfer Neural Style Transfer was always the goal of our project. However, this project was not as much about the goal as it was about the process. Understanding Neural Style Transfer requires a deep understanding of how neural networks, escpecially how the detection works. Experimenting with the input image shows that the outputs of certain layers changes depending upon what kind of feature is changed in the image. The lower layer layers are the most affected by low level features such as lines and blobs. The higher layers are most affected by higher level features. We can use this knowledge to implement Neural Style Transfer. The style of any image is defined by the lower level features like lines, stroke, colors, etc. The content of any image is defined by the higher level features like face, body, etc. We obviously require a trained neural network for this and we use VGG-19 for this purpose. Using all we have learned uptill now, we used VGG-19 to extract style from style image and content content image and blend them together. We start by passing both our input images seperately through the neural network. We can then find out the activations from the lower layer of the style image for our style and activations of the higher layer of the content image for our content. We also pass a randomly generated image and compare the lower layer activations to the style activations and the higher layer activations to the content activations. We then change this image itself to reduce the loss function as much as possible. In the end, we shall have an image that has the style of the style image and the content of the content image. We implemented NST on tensorflow and keras. ## A step further We completed our initial goal of implementing NST well before time. So, we started exploring ways to extend the scope of our project. We considered trying out other variations of neural style tansdfer itself. However, in the end we felt like learning about GANs(Generative Adversarial Networks) was the natural progression of our project. Generative Adversarial Networks takes up a game-theoretic approach, unlike a conventional neural network. The network learns to generate from a training distribution through a 2-player game. The two entities are Generator and Discriminator. These two adversaries are in constant battle throughout the training process. We have 2 Neural Networks in this case - A generator network and a discriminator network. The Generator network creates an image and the discriminator network determined whether its a real image or a fake one genrated by the generator. Whil training the generator gets better at making images that can fool the discriminator and the discriminator gets better at generating images that can accurately identify fake images. Thus, both the networks force each other to get better at their tasks. ## Faces never seen before We first started by implementing GANs for face generation. We neede a dataset of face images for which we used facemask_lite/withoutmask dataset which contained 9896 images. GANs are very computationaly expensive. So, training this model on your laptops was nearly impossible as it would have taken weeks. Luckily, we got access to our college's DGX server which accelerated our training time by a huge margin. ## CycleGANs The final task we completed in our project was CycleGANs. The Cycle Generative Adversarial Network, or CycleGAN, is an approach to training a deep convolutional neural network for image-to-image translation tasks. The Network learns mapping between input and output images using unpaired dataset. This model architecture has 2 generator models. One generator generates output images and the other generator converts output image back to input image. CycleGANs are essential for image to image translation when we dont have a paired image dataset. We implemented CycleGAN for a horse to zebra style transfer. This model converted any image of a horse to zebra. This style transfer is relatively easy for the model to do since the shape of horses and zebras are similar. Only the stripes have to be added in. We needed a dataset of images of zebras and horses. We used tensorflow dataset to import a dataset call cycle_gan/horse2zebra It has 2 classes of images - zebras and horses.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully