All Projects â†’ Mayukhdeb â†’ Torch Dreams

Mayukhdeb / Torch Dreams

Licence: mit
Making neural networks more interpretable, for research and art 🔎 💻 :brain: 🎨

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Torch Dreams

Vosk Api
Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Stars: ✭ 1,357 (+1230.39%)
Mutual labels:  deep-neural-networks
Planematch
[ECCV'18 Oral] PlaneMatch: Patch Coplanarity Prediction for Robust RGB-D Reconstruction
Stars: ✭ 105 (+2.94%)
Mutual labels:  deep-neural-networks
Selfdrivingcar
A collection of all projects pertaining to different layers in the SDC software stack
Stars: ✭ 107 (+4.9%)
Mutual labels:  deep-neural-networks
Models
DLTK Model Zoo
Stars: ✭ 101 (-0.98%)
Mutual labels:  deep-neural-networks
Tensorflow2.0 Examples
🙄 Difficult algorithm, Simple code.
Stars: ✭ 1,397 (+1269.61%)
Mutual labels:  deep-neural-networks
Opentpod
Open Toolkit for Painless Object Detection
Stars: ✭ 106 (+3.92%)
Mutual labels:  deep-neural-networks
Top Deep Learning
Top 200 deep learning Github repositories sorted by the number of stars.
Stars: ✭ 1,365 (+1238.24%)
Mutual labels:  deep-neural-networks
Faceswap
Deepfakes Software For All
Stars: ✭ 39,911 (+39028.43%)
Mutual labels:  deep-neural-networks
Faceaging By Cyclegan
Stars: ✭ 105 (+2.94%)
Mutual labels:  deep-neural-networks
Video2description
Video to Text: Generates description in natural language for given video (Video Captioning)
Stars: ✭ 107 (+4.9%)
Mutual labels:  deep-neural-networks
Crfasrnn pytorch
CRF-RNN PyTorch version http://crfasrnn.torr.vision
Stars: ✭ 102 (+0%)
Mutual labels:  deep-neural-networks
Intro To Deep Learning
A collection of materials to help you learn about deep learning
Stars: ✭ 103 (+0.98%)
Mutual labels:  deep-neural-networks
Ssd Pytorch
SSD: Single Shot MultiBox Detector pytorch implementation focusing on simplicity
Stars: ✭ 107 (+4.9%)
Mutual labels:  deep-neural-networks
Sdr Densenet Pytorch
Stochastic Delta Rule implemented in Pytorch on DenseNet
Stars: ✭ 102 (+0%)
Mutual labels:  deep-neural-networks
Neural Doodle
Turn your two-bit doodles into fine artworks with deep neural networks, generate seamless textures from photos, transfer style from one image to another, perform example-based upscaling, but wait... there's more! (An implementation of Semantic Style Transfer.)
Stars: ✭ 9,680 (+9390.2%)
Mutual labels:  deep-neural-networks
Androidtensorflowmachinelearningexample
Android TensorFlow MachineLearning Example (Building TensorFlow for Android)
Stars: ✭ 1,369 (+1242.16%)
Mutual labels:  deep-neural-networks
Jlm
A fast LSTM Language Model for large vocabulary language like Japanese and Chinese
Stars: ✭ 105 (+2.94%)
Mutual labels:  deep-neural-networks
Video To Retail Platform
An intelligent multimodal-learning based system for video, product and ads analysis. Based on the system, people can build a lot of downstream applications such as product recommendation, video retrieval, etc.
Stars: ✭ 108 (+5.88%)
Mutual labels:  deep-neural-networks
Deep learning object detection
A paper list of object detection using deep learning.
Stars: ✭ 10,334 (+10031.37%)
Mutual labels:  deep-neural-networks
Ict
Code for reproducing ICT ( published in IJCAI 2019)
Stars: ✭ 107 (+4.9%)
Mutual labels:  deep-neural-networks

Torch-Dreams

Making neural networks more interpretable, for research and art.

Open In Colab build

pip install torch-dreams 

Quick start

Make sure you also check out the quick start colab notebook and the docs for more interesting examples.

import matplotlib.pyplot as plt
import torchvision.models as models
from torch_dreams.dreamer import dreamer

model = models.inception_v3(pretrained=True)
dreamy_boi = dreamer(model,  device = 'cuda', quiet =  False)

image_param = dreamy_boi.render(
    layers = [model.Mixed_5b],
)

plt.imshow(image_param.rgb)
plt.show()

You can also optimize activations from multiple models simultaneously

First, let's pick 2 models and specify which layers we'd want to work with

from torch_dreams.model_bunch import ModelBunch

bunch = ModelBunch(
    model_dict = {
        'inception': models.inception_v3(pretrained=True).eval(),
        'resnet':    models.resnet18(pretrained= True).eval()
    }
)

layers_to_use = [
            bunch.model_dict['inception'].Mixed_6a,
            bunch.model_dict['resnet'].layer2[0].conv1
        ]

dreamy_boi = dreamer(model = bunch, quiet= True, device= 'cuda')

Then define a custom_func which determines which exact activations of the models we have to optimize

def custom_func(layer_outputs):
    loss =   layer_outputs[0].mean()*2.0 + layer_outputs[1][89].mean() 
    return -loss

Run the optimization

image_param = dreamy_boi.render(
    layers = layers_to_use,
    custom_func= custom_func,
    iters= 100
)

plt.imshow(image_param.rgb)
plt.show()

Visualize individual channels

layers_to_use = [model.Mixed_6b.branch1x1.conv]

def make_custom_func(layer_number = 0, channel_number= 0): 
    def custom_func(layer_outputs):
        loss = layer_outputs[layer_number][channel_number].mean()
        return -loss
    return custom_func

my_custom_func = make_custom_func(layer_number= 0, channel_number = 119)

image_param = dreamy_boi.render(
    layers = layers_to_use,
    custom_func = my_custom_func,
)
plt.imshow(image_param.rgb)
plt.show()

Acknowledgements

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].