├── .gitignore ├── Dockerfile ├── README.md ├── deepdream ├── deepdream.py ├── favicon.ico ├── index.html ├── inputs │ └── .gitkeep ├── make_json.sh ├── outputs │ └── .gitkeep ├── process_images.sh ├── process_images_once.sh ├── scripts │ ├── angular-deckgrid.js │ ├── angular-deckgrid.min.js │ ├── app.js │ ├── controllers │ │ ├── home.js │ │ └── home.js~ │ ├── directives │ │ └── imageloaded.js │ └── vendor │ │ ├── angular-route.min.js │ │ ├── angular.min.js │ │ └── lodash.min.js ├── serve_files.sh ├── settings.json ├── styles │ ├── images │ │ └── spinner.gif │ ├── main.css │ └── vendor │ │ └── hint.css └── templates │ ├── deckgrid-card.html │ └── home.html ├── deepdream_vision_ai_screenshot.png ├── deepdream_vision_ai_screenshot2.png ├── deepdream_vision_ai_screenshot3.png ├── enter.sh ├── start.sh ├── stop.sh └── youtube.sh /.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | inputs 3 | outputs 4 | tmp.prototxt 5 | log.html 6 | input.jpg 7 | output.jpg 8 | images.json 9 | *.mp4 -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | 4 | ENV PYTHONPATH /opt/caffe/python 5 | 6 | # Add caffe binaries to path 7 | ENV PATH $PATH:/opt/caffe/.build_release/tools 8 | 9 | # Get dependencies 10 | RUN apt-get update && apt-get install -y \ 11 | bc \ 12 | cmake \ 13 | curl \ 14 | gcc-4.6 \ 15 | g++-4.6 \ 16 | gcc-4.6-multilib \ 17 | g++-4.6-multilib \ 18 | gfortran \ 19 | git \ 20 | libprotobuf-dev \ 21 | libleveldb-dev \ 22 | libsnappy-dev \ 23 | libopencv-dev \ 24 | libboost-all-dev \ 25 | libhdf5-serial-dev \ 26 | liblmdb-dev \ 27 | libjpeg62 \ 28 | libfreeimage-dev \ 29 | libatlas-base-dev \ 30 | pkgconf \ 31 | protobuf-compiler \ 32 | python-dev \ 33 | python-pip \ 34 | unzip \ 35 | wget \ 36 | python-numpy \ 37 | python-scipy \ 38 | python-pandas \ 39 | python-sympy \ 40 | python-nose 41 | 42 | # Use gcc 4.6 43 | RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-4.6 30 && \ 44 | update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-4.6 30 && \ 45 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 30 && \ 46 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 30 47 | 48 | 49 | 50 | # Clone the Caffe repo 51 | RUN cd /opt && git clone https://github.com/BVLC/caffe.git 52 | 53 | 54 | # Glog 55 | RUN cd /opt && wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz && \ 56 | tar zxvf glog-0.3.3.tar.gz && \ 57 | cd /opt/glog-0.3.3 && \ 58 | ./configure && \ 59 | make && \ 60 | make install 61 | 62 | # Workaround for error loading libglog: 63 | # error while loading shared libraries: libglog.so.0: cannot open shared object file 64 | # The system already has /usr/local/lib listed in /etc/ld.so.conf.d/libc.conf, so 65 | # running `ldconfig` fixes the problem (which is simpler than using $LD_LIBRARY_PATH) 66 | # TODO: looks like this needs to be run _every_ time a new docker instance is run, 67 | # so maybe LD_LIBRARY_PATh is a better approach (or add call to ldconfig in ~/.bashrc) 68 | RUN ldconfig 69 | 70 | # Gflags 71 | RUN cd /opt && \ 72 | wget https://github.com/schuhschuh/gflags/archive/master.zip && \ 73 | unzip master.zip && \ 74 | cd /opt/gflags-master && \ 75 | mkdir build && \ 76 | cd /opt/gflags-master/build && \ 77 | export CXXFLAGS="-fPIC" && \ 78 | cmake .. && \ 79 | make VERBOSE=1 && \ 80 | make && \ 81 | make install 82 | 83 | # Build Caffe core 84 | RUN cd /opt/caffe && \ 85 | cp Makefile.config.example Makefile.config && \ 86 | echo "CPU_ONLY := 1" >> Makefile.config && \ 87 | echo "CXX := /usr/bin/g++-4.6" >> Makefile.config && \ 88 | sed -i 's/CXX :=/CXX ?=/' Makefile && \ 89 | make all 90 | 91 | # Add ld-so.conf so it can find libcaffe.so 92 | #ADD caffe-ld-so.conf /etc/ld.so.conf.d/ 93 | 94 | # Run ldconfig again (not sure if needed) 95 | RUN ldconfig 96 | 97 | # Install python deps 98 | RUN cd /opt/caffe && \ 99 | (pip install -r python/requirements.txt) 100 | 101 | # Numpy include path hack - github.com/BVLC/caffe/wiki/Setting-up-Caffe-on-Ubuntu-14.04 102 | #RUN NUMPY_EGG=`ls /usr/local/lib/python2.7/dist-packages | grep -i numpy` && \ 103 | # ln -s /usr/local/lib/python2.7/dist-packages/$NUMPY_EGG/numpy/core/include/numpy /usr/include/python2.7/numpy 104 | 105 | # Build Caffe python bindings 106 | RUN cd /opt/caffe && make pycaffe 107 | 108 | 109 | # Make + run tests 110 | RUN cd /opt/caffe && make test && make runtest 111 | 112 | #Download GoogLeNet 113 | RUN /opt/caffe/scripts/download_model_binary.py /opt/caffe/models/bvlc_googlenet 114 | 115 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dockerized deepdream: Generate ConvNet Art in the Cloud 2 | 3 | Google recently released the 4 | [deepdream](https://github.com/google/deepdream) software package for generating images like 5 | 6 | ![ConvNet Art](http://1.bp.blogspot.com/-CdUrPm7x5Ig/VZQIGjJzP0I/AAAAAAAAAnI/qhqchfzdaOc/s640/image00.jpg) 7 | 8 | which uses the [Caffe](http://caffe.berkeleyvision.org/) Deep Learning 9 | Library and a cool iPython notebook example. 10 | 11 | Setting up Caffe, Python, and all of the required dependencies is not 12 | trivial if you haven't done it before! More importantly, a GPU isn't 13 | required if you're willing to wait a couple of seconds for the images 14 | to be generated. 15 | 16 | Let's make it brain-dead simple to launch your very own 17 | deepdreaming server (in the cloud, on an Ubuntu machine, Mac via 18 | Docker, and maybe even Windows if you try out Kitematic by Docker)! 19 | 20 | ### Motivation 21 | 22 | I decided to create a self-contained Caffe+GoogLeNet+Deepdream Docker image 23 | which has everything you need to generate your own deepdream art. In 24 | order to make the Docker image very portable, it uses the CPU version 25 | of Caffe and comes bundled with the GoogLeNet model. 26 | 27 | The compilation procedure was done on Docker Hub and for advanced 28 | users, the final image can be pulled down via: 29 | 30 | ``` 31 | docker pull visionai/clouddream 32 | ``` 33 | 34 | The docker image is 2.5GB, but it contains a precompiled version of 35 | Caffe, all of the python dependencies, as well as the pretrained 36 | GoogLeNet model. 37 | 38 | For those of you who are new to Docker, I hope you will pick up some 39 | valuable engineering skills and tips along the way. Docker makes it very easy 40 | to bundle complex software. If you're somebody like me who likes a 41 | clean Mac OS X on a personal laptop, and do the heavy-lifting in the 42 | cloud, then read on. 43 | 44 | # Instructions 45 | 46 | We will be monitoring the `inputs` directory for source images and 47 | dumping results into the `outputs` directory. Nginx (also inside a 48 | Docker container) will be used to serve the resulting files and a 49 | simple AngularJS GUI to render the images in a webpage. 50 | 51 | Prerequisite: 52 | 53 | You've launched a Cloud instance using a VPS provider like 54 | DigitalOcean and this instance has Docker running. If you don't know 55 | about DigitalOcean, then you should give them a try. You can lauch a 56 | Docker-ready cloud instance in a few minutes. If you're going to set 57 | up a new DigitalOcean account, consider using my referral link: 58 | [https://www.digitalocean.com/?refcode=64f90f652091](https://www.digitalocean.com/?refcode=64f90f652091). 59 | 60 | Will need an instance with at least 1GB of RAM for processing small output images. 61 | 62 | Let's say our cloud instance is at the address 1.2.3.4 and we set it 63 | up so that it contains our SSH key for passwordless log-in. 64 | 65 | ``` 66 | ssh root@1.2.3.4 67 | git clone https://github.com/VISIONAI/clouddream.git 68 | cd clouddream 69 | ./start.sh 70 | ``` 71 | 72 | To make sure everything is working properly you can do 73 | ``` 74 | docker ps 75 | ``` 76 | 77 | You should see three running containers: deepdream-json, deepdream-compute, and deepdream-files 78 | ``` 79 | root@deepdream:~/clouddream# docker ps 80 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 81 | 21d495211abf ubuntu:14.04 "/bin/bash -c 'cd /o 7 minutes ago Up 7 minutes deepdream-json 82 | 7dda17dafa5a visionai/clouddream "/bin/bash -c 'cd /o 7 minutes ago Up 7 minutes deepdream-compute 83 | 010427d8c7c2 nginx "nginx -g 'daemon of 7 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, 443/tcp deepdream-files 84 | ``` 85 | 86 | If you want to stop the processing, just run: 87 | ``` 88 | ./stop.sh 89 | ``` 90 | 91 | If you want to jump inside the container to debug something, just run: 92 | ``` 93 | ./enter.sh 94 | cd /opt/deepdream 95 | python deepdream.py 96 | #This will take input.jpg, run deepdream, and write output.jpg 97 | ``` 98 | 99 | ## Feeding images into deepdream 100 | 101 | From your local machine you can just scp images into the `inputs` 102 | directory inside deepdream as follows: 103 | 104 | ``` 105 | # From your local machine 106 | scp images/*jpg root@1.2.3.4:~/clouddream/deepdream/inputs/ 107 | ``` 108 | 109 | ## Instructions for Mac OS X and boot2docker 110 | 111 | First, install boot2docker. Now start boot2docker. 112 | 113 | ``` 114 | boot2docker start 115 | ``` 116 | 117 | 118 | My boot2docker on Mac returns something like this: 119 | ``` 120 | Waiting for VM and Docker daemon to start... 121 | .............o 122 | Started. 123 | Writing /Users/tomasz/.boot2docker/certs/boot2docker-vm/ca.pem 124 | Writing /Users/tomasz/.boot2docker/certs/boot2docker-vm/cert.pem 125 | Writing /Users/tomasz/.boot2docker/certs/boot2docker-vm/key.pem 126 | 127 | To connect the Docker client to the Docker daemon, please set: 128 | export DOCKER_TLS_VERIFY=1 129 | export DOCKER_HOST=tcp://192.168.59.103:2376 130 | export DOCKER_CERT_PATH=/Users/tomasz/.boot2docker/certs/boot2docker-vm 131 | ``` 132 | 133 | So I simply paste the last three lines (the ones starting with export) 134 | right into the terminal. 135 | ``` 136 | export DOCKER_TLS_VERIFY=1 137 | export DOCKER_HOST=tcp://192.168.59.103:2376 138 | export DOCKER_CERT_PATH=/Users/tomasz/.boot2docker/certs/boot2docker-vm 139 | ``` 140 | 141 | Keep this IP address in mind. For me it is `192.168.59.103`. 142 | 143 | NOTE: if running a `docker ps` command fails at this point and it says 144 | something about certificates, you can try: 145 | ``` 146 | boot2docker ssh sudo /etc/init.d/docker restart 147 | ``` 148 | 149 | Now proceed just like you're in a Linux environment. 150 | 151 | ``` 152 | cd ~/projects 153 | git clone https://github.com/VISIONAI/clouddream.git 154 | cd clouddream 155 | ./start.sh 156 | ``` 157 | 158 | You should now be able to visit `http://192.168.59.103` in your browser. 159 | 160 | ## Processing a YouTube video 161 | 162 | If don't have your own source of cool jpg images to process, or simply 163 | want to see what the output looks like on a youtube video, I've 164 | included a short `youtube.sh` script which does all the work for you. 165 | 166 | If you want to start processing the "Charlie Bit My Finger" video, simply run: 167 | ``` 168 | ./youtube.sh https://www.youtube.com/watch?v=DDZQAJuB3rI 169 | ``` 170 | 171 | And then visit the `http://1.2.3.4:8000` URL to see the frames show up 172 | as they are being processed one by one. The final result will be 173 | writen to `http://1.2.3.4/out.mp4` 174 | 175 | Here are some frames from the 176 | [Daft Punk - Pentatonix](https://www.youtube.com/watch?v=3MteSlpxCpo) 177 | video: 178 | 179 | ![deepdreaming Pentatonix](https://raw.githubusercontent.com/VISIONAI/clouddream/master/deepdream_vision_ai_screenshot3.png) 180 | 181 | 182 | ## Navigating the Image Gallery 183 | 184 | You should now be able to visit `http://1.2.3.4` in your browser and 185 | see the resulting images appear in a nicely formatted mobile-ready grid. 186 | 187 | You can also show only `N` images by changing to the URL so something like this: 188 | ``` 189 | http://1.2.3.4/#/?N=20 190 | ``` 191 | 192 | And instead of showing random `N` images, you can view the latest images: 193 | ``` 194 | http://1.2.3.4/#/?latest 195 | ``` 196 | 197 | You can view the processing log here: 198 | ``` 199 | http://1.2.3.4/log.html 200 | ``` 201 | 202 | You can view the current image being processed: 203 | ``` 204 | http://1.2.3.4/input.jpg 205 | ``` 206 | 207 | You can view the current settings: 208 | ``` 209 | http://1.2.3.4/settings.json 210 | ``` 211 | 212 | 213 | Here is a screenshot of what things should look like when using the 'conv2/3x3' setting: 214 | ![deepdreaming Dali](https://raw.githubusercontent.com/VISIONAI/clouddream/master/deepdream_vision_ai_screenshot.png) 215 | 216 | And if you instead use the 'inception_4c/output' setting: 217 | ![deepdreaming Dali](https://raw.githubusercontent.com/VISIONAI/clouddream/master/deepdream_vision_ai_screenshot2.png) 218 | 219 | Additionally, you can browse some more cool images on the 220 | [deepdream.vision.ai](http://deepdream.vision.ai) server, which I've 221 | currently configured to run deepdream through some Dali art. When you 222 | go to the page, just hit refresh to see more goodies. 223 | 224 | ### User contributed DeepDream images 225 | 226 | Several people ran their own experiments on different images and 227 | different layers. For example, GitHub user 228 | [ihaventkilledanybodysince1984](https://github.com/ihaventkilledanybodysince1984) 229 | shows an example of different layer effects on a frog drawing. 230 | 231 | ![deepdream frog](http://i.imgur.com/z1jAHqZ.jpg) 232 | 233 | Check out the [frog face effect gallery on imgur](http://imgur.com/a/yMCGZ). 234 | 235 | 236 | ### Changing image size and processing layer 237 | 238 | Inside deepdream/settings.json you'll find a settings file that looks like this: 239 | ```javascript 240 | { 241 | "maxwidth" : 400, 242 | "layer" : "inception_4c/output" 243 | } 244 | ``` 245 | 246 | You can change `maxwidth` to something larger like 1000 if you want 247 | big output images for big input images, remeber that will you need more RAM memory 248 | for processing lager images. For testing `maxwidth` of 200 249 | will give you results much faster. If you change the settings and 250 | want to regenerate outputs for your input images, simply remove the 251 | contents of the outputs directory: 252 | 253 | ``` 254 | rm deepdream/outputs/* 255 | ``` 256 | 257 | Possible values for `layer` are as follows. They come from the 258 | tmp.prototxt file which lists the layers of the GoogLeNet network used 259 | in this demo. Note that the ReLU and Dropout layers are not valid for deepdreaming. 260 | 261 | ``` 262 | "conv1/7x7_s2" 263 | "pool1/3x3_s2" 264 | "pool1/norm1" 265 | "conv2/3x3_reduce" 266 | "conv2/3x3" 267 | "conv2/norm2" 268 | "pool2/3x3_s2" 269 | "inception_3a/1x1" 270 | "inception_3a/3x3_reduce" 271 | "inception_3a/3x3" 272 | "inception_3a/5x5_reduce" 273 | "inception_3a/5x5" 274 | "inception_3a/pool" 275 | "inception_3a/pool_proj" 276 | "inception_3a/output" 277 | "inception_3b/1x1" 278 | "inception_3b/3x3_reduce" 279 | "inception_3b/3x3" 280 | "inception_3b/5x5_reduce" 281 | "inception_3b/5x5" 282 | "inception_3b/pool" 283 | "inception_3b/pool_proj" 284 | "inception_3b/output" 285 | "pool3/3x3_s2" 286 | "inception_4a/1x1" 287 | "inception_4a/3x3_reduce" 288 | "inception_4a/3x3" 289 | "inception_4a/5x5_reduce" 290 | "inception_4a/5x5" 291 | "inception_4a/pool" 292 | "inception_4a/pool_proj" 293 | "inception_4a/output" 294 | "inception_4b/1x1" 295 | "inception_4b/3x3_reduce" 296 | "inception_4b/3x3" 297 | "inception_4b/5x5_reduce" 298 | "inception_4b/5x5" 299 | "inception_4b/pool" 300 | "inception_4b/pool_proj" 301 | "inception_4b/output" 302 | "inception_4c/1x1" 303 | "inception_4c/3x3_reduce" 304 | "inception_4c/3x3" 305 | "inception_4c/5x5_reduce" 306 | "inception_4c/5x5" 307 | "inception_4c/pool" 308 | "inception_4c/pool_proj" 309 | "inception_4c/output" 310 | "inception_4d/1x1" 311 | "inception_4d/3x3_reduce" 312 | "inception_4d/3x3" 313 | "inception_4d/5x5_reduce" 314 | "inception_4d/5x5" 315 | "inception_4d/pool" 316 | "inception_4d/pool_proj" 317 | "inception_4d/output" 318 | "inception_4e/1x1" 319 | "inception_4e/3x3_reduce" 320 | "inception_4e/3x3" 321 | "inception_4e/5x5_reduce" 322 | "inception_4e/5x5" 323 | "inception_4e/pool" 324 | "inception_4e/pool_proj" 325 | "inception_4e/output" 326 | "pool4/3x3_s2" 327 | "inception_5a/1x1" 328 | "inception_5a/3x3_reduce" 329 | "inception_5a/3x3" 330 | "inception_5a/5x5_reduce" 331 | "inception_5a/5x5" 332 | "inception_5a/pool" 333 | "inception_5a/pool_proj" 334 | "inception_5a/output" 335 | "inception_5b/1x1" 336 | "inception_5b/3x3_reduce" 337 | "inception_5b/3x3" 338 | "inception_5b/5x5_reduce" 339 | "inception_5b/5x5" 340 | "inception_5b/pool" 341 | "inception_5b/pool_proj" 342 | "inception_5b/output" 343 | ``` 344 | 345 | ### The GUI 346 | 347 | The final GUI is based on https://github.com/akoenig/angular-deckgrid. 348 | 349 | ### Credits 350 | 351 | The included Dockerfile is an extended version of 352 | https://github.com/taras-sereda/docker_ubuntu_caffe 353 | 354 | Which is a modification from the original Caffe CPU master Dockerfile tleyden: 355 | https://github.com/tleyden/docker/tree/master/caffe/cpu/master 356 | 357 | This dockerfile uses the deepdream code from: 358 | https://github.com/google/deepdream 359 | 360 | ### License 361 | 362 | MIT License. Have fun. Never stop learning. 363 | 364 | --Enjoy! 365 | The vision.ai team 366 | 367 | 368 | -------------------------------------------------------------------------------- /deepdream/deepdream.py: -------------------------------------------------------------------------------- 1 | # imports and basic notebook setup 2 | from cStringIO import StringIO 3 | import numpy as np 4 | import scipy.ndimage as nd 5 | import PIL.Image 6 | import json 7 | from IPython.display import clear_output, Image, display 8 | from google.protobuf import text_format 9 | 10 | import caffe 11 | 12 | def showarray(a, fmt='jpeg'): 13 | a = np.uint8(np.clip(a, 0, 255)) 14 | f = StringIO() 15 | PIL.Image.fromarray(a).save(f, fmt) 16 | display(Image(data=f.getvalue())) 17 | 18 | with open("settings.json") as json_file: 19 | json_data = json.load(json_file) 20 | #print() 21 | 22 | 23 | model_path = '../caffe/models/bvlc_googlenet/' # substitute your path here 24 | net_fn = model_path + 'deploy.prototxt' 25 | param_fn = model_path + 'bvlc_googlenet.caffemodel' 26 | 27 | # Patching model to be able to compute gradients. 28 | # Note that you can also manually add "force_backward: true" line to "deploy.prototxt". 29 | model = caffe.io.caffe_pb2.NetParameter() 30 | text_format.Merge(open(net_fn).read(), model) 31 | model.force_backward = True 32 | open('tmp.prototxt', 'w').write(str(model)) 33 | 34 | net = caffe.Classifier('tmp.prototxt', param_fn, 35 | mean = np.float32([104.0, 116.0, 122.0]), # ImageNet mean, training set dependent 36 | channel_swap = (2,1,0)) # the reference model has channels in BGR order instead of RGB 37 | 38 | # a couple of utility functions for converting to and from Caffe's input image layout 39 | def preprocess(net, img): 40 | return np.float32(np.rollaxis(img, 2)[::-1]) - net.transformer.mean['data'] 41 | def deprocess(net, img): 42 | return np.dstack((img + net.transformer.mean['data'])[::-1]) 43 | 44 | def make_step(net, step_size=1.5, end='inception_4c/output', jitter=32, clip=True): 45 | '''Basic gradient ascent step.''' 46 | 47 | src = net.blobs['data'] # input image is storred in Net's 'data' blob 48 | dst = net.blobs[end] 49 | 50 | ox, oy = np.random.randint(-jitter, jitter+1, 2) 51 | src.data[0] = np.roll(np.roll(src.data[0], ox, -1), oy, -2) # apply jitter shift 52 | 53 | net.forward(end=end) 54 | dst.diff[:] = dst.data # specify the optimiation objective 55 | net.backward(start=end) 56 | g = src.diff[0] 57 | # apply normaized ascent step to the input image 58 | src.data[:] += step_size/np.abs(g).mean() * g 59 | 60 | src.data[0] = np.roll(np.roll(src.data[0], -ox, -1), -oy, -2) # unshift image 61 | 62 | if clip: 63 | bias = net.transformer.mean['data'] 64 | src.data[:] = np.clip(src.data, -bias, 255-bias) 65 | 66 | def deepdream(net, base_img, iter_n=10, octave_n=4, octave_scale=1.4, end='inception_4c/output', clip=True, **step_params): 67 | # prepare base images for all octaves 68 | octaves = [preprocess(net, base_img)] 69 | for i in xrange(octave_n-1): 70 | octaves.append(nd.zoom(octaves[-1], (1, 1.0/octave_scale,1.0/octave_scale), order=1)) 71 | 72 | src = net.blobs['data'] 73 | detail = np.zeros_like(octaves[-1]) # allocate image for network-produced details 74 | for octave, octave_base in enumerate(octaves[::-1]): 75 | h, w = octave_base.shape[-2:] 76 | if octave > 0: 77 | # upscale details from the previous octave 78 | h1, w1 = detail.shape[-2:] 79 | detail = nd.zoom(detail, (1, 1.0*h/h1,1.0*w/w1), order=1) 80 | 81 | src.reshape(1,3,h,w) # resize the network's input image size 82 | src.data[0] = octave_base+detail 83 | for i in xrange(iter_n): 84 | make_step(net, end=end, clip=clip, **step_params) 85 | 86 | # visualization 87 | vis = deprocess(net, src.data[0]) 88 | if not clip: # adjust image contrast if clipping is disabled 89 | vis = vis*(255.0/np.percentile(vis, 99.98)) 90 | #showarray(vis) 91 | print octave, i, end, vis.shape 92 | clear_output(wait=True) 93 | 94 | # extract details produced on the current octave 95 | detail = src.data[0]-octave_base 96 | # returning the resulting image 97 | return deprocess(net, src.data[0]) 98 | 99 | 100 | maxwidth = json_data['maxwidth'] 101 | img = PIL.Image.open('input.jpg') 102 | width = img.size[0] 103 | 104 | if width > maxwidth: 105 | wpercent = (maxwidth/float(img.size[0])) 106 | hsize = int((float(img.size[1])*float(wpercent))) 107 | img = img.resize((maxwidth,hsize), PIL.Image.ANTIALIAS) 108 | 109 | img = np.float32(img) 110 | 111 | frame = img 112 | #frame_i = 0 113 | 114 | frame = deepdream(net, frame, end=json_data['layer']) 115 | #frame = deepdream(net, img, end='inception_3b/5x5_reduce') 116 | #frame = deepdream(net, img, end='conv2/3x3') 117 | 118 | PIL.Image.fromarray(np.uint8(frame)).save("output.jpg") 119 | 120 | #h, w = frame.shape[:2] 121 | #s = 0.05 # scale coefficient 122 | #for i in xrange(100): 123 | # frame = deepdream(net, frame) 124 | # PIL.Image.fromarray(np.uint8(frame)).save("output/%04d.jpg"%frame_i) 125 | # frame = nd.affine_transform(frame, [1-s,1-s,1], [h*s/2,w*s/2,0], order=1) 126 | # frame_i += 1 127 | -------------------------------------------------------------------------------- /deepdream/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream/favicon.ico -------------------------------------------------------------------------------- /deepdream/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | deepdream.vision.ai 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /deepdream/inputs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream/inputs/.gitkeep -------------------------------------------------------------------------------- /deepdream/make_json.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to make an images.json file from the contents of all files 3 | # inside the outputs/ directory 4 | # 5 | # Generate a json file from a directory listing so that it can be consumed by 6 | # $http inside angularjs-deckgrid 7 | # Copyright vision.ai, 2015 8 | 9 | #the amount of time to wait before regenerating images.json 10 | SLEEP_TIME=5 11 | 12 | make_json () { 13 | 14 | cd outputs 15 | 16 | rm ../temp.json 2>/dev/null 17 | touch ../temp.json 18 | chmod 644 ../temp.json 19 | echo -n "[" > ../temp.json 20 | 21 | nfiles=`find . -type f -not -path '*/\.*' | wc -l` 22 | echo nf is $nfiles 23 | 24 | counter=1 25 | find . -type f -not -path '*/\.*' -print0 | while read -d $'\0' f; 26 | do 27 | id=$counter 28 | name=`basename $f` 29 | src="/outputs/$name" 30 | echo -n "{\"id\":\"$id\",\"name\":\"$name\",\"src\":\"$src\"}" >> ../temp.json 31 | if [ "$id" != "$nfiles" ]; then 32 | echo -n "," >> ../temp.json 33 | else 34 | echo "skipping trailing one" 35 | fi 36 | counter=`expr $counter + 1` 37 | done 38 | echo -n "]" >> ../temp.json 39 | mv ../temp.json ../images.json 40 | 41 | cd - 2>&1 /dev/null 42 | echo "Finished processing " `expr $counter - 1` "files" 43 | } 44 | 45 | cd `dirname $0` 46 | 47 | 48 | #Start the infinite for loop which will keep regenerating image.json 49 | while [ true ]; 50 | do 51 | echo "Making images.json" 52 | make_json; 53 | sleep ${SLEEP_TIME}; 54 | done 55 | -------------------------------------------------------------------------------- /deepdream/outputs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream/outputs/.gitkeep -------------------------------------------------------------------------------- /deepdream/process_images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to process all of the images inside the inputs/ folder 3 | # We will be running this script inside the visionai/clouddream Docker image 4 | # Copyright vision.ai, 2015 5 | 6 | while [ true ]; 7 | do 8 | ./process_images_once.sh 9 | sleep 1 10 | done 11 | -------------------------------------------------------------------------------- /deepdream/process_images_once.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to process all of the images inside the inputs/ folder 3 | # We will be running this script inside the visionai/clouddream Docker image 4 | # Copyright vision.ai, 2015 5 | 6 | cd /opt/deepdream/inputs 7 | find . -type f -not -path '*/\.*' -print0 | while read -d $'\0' f; 8 | do 9 | cd /opt/deepdream 10 | if [ -e outputs/${f} ]; 11 | then 12 | echo "File ${f} already processed" 13 | else 14 | echo "Deepdream" ${f} 15 | chmod gou+r inputs/${f} 16 | cp inputs/${f} input.jpg 17 | python deepdream.py 18 | ERROR_CODE=$? 19 | echo "Error Code is" ${ERROR_CODE} 20 | cp output.jpg outputs/${f} 21 | rm output.jpg 22 | echo "Just created" outputs/${f} 23 | fi 24 | done 25 | 26 | 27 | -------------------------------------------------------------------------------- /deepdream/scripts/angular-deckgrid.js: -------------------------------------------------------------------------------- 1 | /*! angular-deckgrid (v0.5.0) - Copyright: 2013 - 2014, André König (andre.koenig@posteo.de) - MIT */ 2 | /* 3 | * angular-deckgrid 4 | * 5 | * Copyright(c) 2013-2014 André König 6 | * MIT Licensed 7 | * 8 | */ 9 | 10 | /** 11 | * @author André König (andre.koenig@posteo.de) 12 | * 13 | */ 14 | 15 | angular.module('akoenig.deckgrid', []); 16 | 17 | angular.module('akoenig.deckgrid').directive('deckgrid', [ 18 | 19 | 'DeckgridDescriptor', 20 | 21 | function initialize (DeckgridDescriptor) { 22 | 23 | 'use strict'; 24 | 25 | return DeckgridDescriptor.create(); 26 | } 27 | ]); 28 | /* 29 | * angular-deckgrid 30 | * 31 | * Copyright(c) 2013-2014 André König 32 | * MIT Licensed 33 | * 34 | */ 35 | 36 | /** 37 | * @author André König (andre.koenig@posteo.de) 38 | * 39 | */ 40 | 41 | angular.module('akoenig.deckgrid').factory('DeckgridDescriptor', [ 42 | 43 | 'Deckgrid', 44 | '$templateCache', 45 | 46 | function initialize (Deckgrid, $templateCache) { 47 | 48 | 'use strict'; 49 | 50 | /** 51 | * This is a wrapper around the AngularJS 52 | * directive description object. 53 | * 54 | */ 55 | function Descriptor () { 56 | this.restrict = 'AE'; 57 | 58 | this.template = '
' + 59 | '
' + 60 | '
'; 61 | 62 | this.scope = { 63 | 'model': '=source' 64 | }; 65 | 66 | // 67 | // Will be created in the linking function. 68 | // 69 | this.$$deckgrid = null; 70 | 71 | this.transclude = true; 72 | this.link = this.$$link.bind(this); 73 | 74 | // 75 | // Will be incremented if using inline templates. 76 | // 77 | this.$$templateKeyIndex = 0; 78 | 79 | } 80 | 81 | /** 82 | * @private 83 | * 84 | * Cleanup method. Will be called when the 85 | * deckgrid directive should be destroyed. 86 | * 87 | */ 88 | Descriptor.prototype.$$destroy = function $$destroy () { 89 | this.$$deckgrid.destroy(); 90 | }; 91 | 92 | /** 93 | * @private 94 | * 95 | * The deckgrid link method. Will instantiate the deckgrid. 96 | * 97 | */ 98 | Descriptor.prototype.$$link = function $$link (scope, elem, attrs, nullController, transclude) { 99 | var templateKey = 'deckgrid/innerHtmlTemplate' + (++this.$$templateKeyIndex) + '.html'; 100 | 101 | scope.$on('$destroy', this.$$destroy.bind(this)); 102 | 103 | if (angular.isUndefined(attrs.cardtemplate)) { 104 | if (angular.isUndefined(attrs.cardtemplatestring)) { 105 | // use the provided inner html as template 106 | transclude(scope, function onTransclude (innerHTML) { 107 | var extractedInnerHTML = [], 108 | i = 0, 109 | len = innerHTML.length, 110 | outerHTML; 111 | 112 | for (i; i < len; i = i + 1) { 113 | outerHTML = innerHTML[i].outerHTML; 114 | 115 | if (angular.isDefined(outerHTML)) { 116 | extractedInnerHTML.push(outerHTML); 117 | } 118 | } 119 | 120 | $templateCache.put(templateKey, extractedInnerHTML.join()); 121 | }); 122 | } else { 123 | // use the provided template string 124 | // 125 | // note: the attr is accessed via the elem object, as the attrs content 126 | // is already compiled and thus lacks the {{...}} expressions 127 | $templateCache.put(templateKey, elem.attr('cardtemplatestring')); 128 | } 129 | 130 | scope.cardTemplate = templateKey; 131 | } else { 132 | // use the provided template file 133 | scope.cardTemplate = attrs.cardtemplate; 134 | } 135 | 136 | scope.mother = scope.$parent; 137 | 138 | this.$$deckgrid = Deckgrid.create(scope, elem[0]); 139 | }; 140 | 141 | return { 142 | create : function create () { 143 | return new Descriptor(); 144 | } 145 | }; 146 | } 147 | ]); 148 | 149 | /* 150 | * angular-deckgrid 151 | * 152 | * Copyright(c) 2013-2014 André König 153 | * MIT Licensed 154 | * 155 | */ 156 | 157 | /** 158 | * @author André König (andre.koenig@posteo.de) 159 | * 160 | */ 161 | 162 | angular.module('akoenig.deckgrid').factory('Deckgrid', [ 163 | 164 | '$window', 165 | '$log', 166 | 167 | function initialize ($window, $log) { 168 | 169 | 'use strict'; 170 | 171 | /** 172 | * The deckgrid directive. 173 | * 174 | */ 175 | function Deckgrid (scope, element) { 176 | var self = this, 177 | watcher, 178 | mql; 179 | 180 | this.$$elem = element; 181 | this.$$watchers = []; 182 | 183 | this.$$scope = scope; 184 | this.$$scope.columns = []; 185 | 186 | // 187 | // The layout configuration will be parsed from 188 | // the pseudo "before element." There you have to save all 189 | // the column configurations. 190 | // 191 | this.$$scope.layout = this.$$getLayout(); 192 | 193 | this.$$createColumns(); 194 | 195 | // 196 | // Register model change. 197 | // 198 | watcher = this.$$scope.$watchCollection('model', this.$$onModelChange.bind(this)); 199 | 200 | this.$$watchers.push(watcher); 201 | 202 | // 203 | // Register media query change events. 204 | // 205 | angular.forEach(self.$$getMediaQueries(), function onIteration (rule) { 206 | var handler = self.$$onMediaQueryChange.bind(self); 207 | 208 | function onDestroy () { 209 | rule.removeListener(handler); 210 | } 211 | 212 | rule.addListener(handler); 213 | 214 | self.$$watchers.push(onDestroy); 215 | }); 216 | 217 | mql = $window.matchMedia('(orientation: portrait)'); 218 | mql.addListener(self.$$onMediaQueryChange.bind(self)); 219 | 220 | } 221 | 222 | /** 223 | * @private 224 | * 225 | * Extracts the media queries out of the stylesheets. 226 | * 227 | * This method will fetch the media queries out of the stylesheets that are 228 | * responsible for styling the angular-deckgrid. 229 | * 230 | * @return {array} An array with all respective styles. 231 | * 232 | */ 233 | Deckgrid.prototype.$$getMediaQueries = function $$getMediaQueries () { 234 | var stylesheets = [], 235 | mediaQueries = []; 236 | 237 | stylesheets = Array.prototype.concat.call( 238 | Array.prototype.slice.call(document.querySelectorAll('style[type=\'text/css\']')), 239 | Array.prototype.slice.call(document.querySelectorAll('link[rel=\'stylesheet\']')) 240 | ); 241 | 242 | function extractRules (stylesheet) { 243 | try { 244 | return (stylesheet.sheet.cssRules || []); 245 | } catch (e) { 246 | return []; 247 | } 248 | } 249 | 250 | function hasDeckgridStyles (rule) { 251 | var regexe = /\[(\w*-)?deckgrid\]::?before/g, 252 | i = 0, 253 | selector = ''; 254 | 255 | if (!rule.media || angular.isUndefined(rule.cssRules)) { 256 | return false; 257 | } 258 | 259 | i = rule.cssRules.length - 1; 260 | 261 | for (i; i >= 0; i = i - 1) { 262 | selector = rule.cssRules[i].selectorText; 263 | 264 | if (angular.isDefined(selector) && selector.match(regexe)) { 265 | return true; 266 | } 267 | } 268 | 269 | return false; 270 | } 271 | 272 | angular.forEach(stylesheets, function onIteration (stylesheet) { 273 | var rules = extractRules(stylesheet); 274 | 275 | angular.forEach(rules, function inRuleIteration (rule) { 276 | if (hasDeckgridStyles(rule)) { 277 | mediaQueries.push($window.matchMedia(rule.media.mediaText)); 278 | } 279 | }); 280 | }); 281 | 282 | return mediaQueries; 283 | }; 284 | 285 | /** 286 | * @private 287 | * 288 | * Creates the column segmentation. With other words: 289 | * This method creates the internal data structure from the 290 | * passed "source" attribute. Every card within this "source" 291 | * model will be passed into this internal column structure by 292 | * reference. So if you modify the data within your controller 293 | * this directive will reflect these changes immediately. 294 | * 295 | * NOTE that calling this method will trigger a complete template "redraw". 296 | * 297 | */ 298 | Deckgrid.prototype.$$createColumns = function $$createColumns () { 299 | var self = this; 300 | 301 | if (!this.$$scope.layout) { 302 | return $log.error('angular-deckgrid: No CSS configuration found (see ' + 303 | 'https://github.com/akoenig/angular-deckgrid#the-grid-configuration)'); 304 | } 305 | 306 | this.$$scope.columns = []; 307 | 308 | angular.forEach(this.$$scope.model, function onIteration (card, index) { 309 | var column = (index % self.$$scope.layout.columns) | 0; 310 | 311 | if (!self.$$scope.columns[column]) { 312 | self.$$scope.columns[column] = []; 313 | } 314 | 315 | card.$index = index; 316 | self.$$scope.columns[column].push(card); 317 | }); 318 | }; 319 | 320 | /** 321 | * @private 322 | * 323 | * Parses the configuration out of the configured CSS styles. 324 | * 325 | * Example: 326 | * 327 | * .deckgrid::before { 328 | * content: '3 .column.size-1-3'; 329 | * } 330 | * 331 | * Will result in a three column grid where each column will have the 332 | * classes: "column size-1-3". 333 | * 334 | * You are responsible for defining the respective styles within your CSS. 335 | * 336 | */ 337 | Deckgrid.prototype.$$getLayout = function $$getLayout () { 338 | var content = $window.getComputedStyle(this.$$elem, ':before').content, 339 | layout; 340 | 341 | if (content) { 342 | content = content.replace(/'/g, ''); // before e.g. '3 .column.size-1of3' 343 | content = content.replace(/"/g, ''); // before e.g. "3 .column.size-1of3" 344 | content = content.split(' '); 345 | 346 | if (2 === content.length) { 347 | layout = {}; 348 | layout.columns = (content[0] | 0); 349 | layout.classList = content[1].replace(/\./g, ' ').trim(); 350 | } 351 | } 352 | 353 | return layout; 354 | }; 355 | 356 | /** 357 | * @private 358 | * 359 | * Event that will be triggered if a CSS media query changed. 360 | * 361 | */ 362 | Deckgrid.prototype.$$onMediaQueryChange = function $$onMediaQueryChange () { 363 | var self = this, 364 | layout = this.$$getLayout(); 365 | 366 | // 367 | // Okay, the layout has changed. 368 | // Creating a new column structure is not avoidable. 369 | // 370 | if (layout.columns !== this.$$scope.layout.columns) { 371 | self.$$scope.layout = layout; 372 | 373 | self.$$scope.$apply(function onApply () { 374 | self.$$createColumns(); 375 | }); 376 | } 377 | }; 378 | 379 | /** 380 | * @private 381 | * 382 | * Event that will be triggered when the source model has changed. 383 | * 384 | */ 385 | Deckgrid.prototype.$$onModelChange = function $$onModelChange (newModel, oldModel) { 386 | var self = this; 387 | 388 | newModel = newModel || []; 389 | oldModel = oldModel || []; 390 | 391 | if (!angular.equals(oldModel, newModel)) { 392 | self.$$createColumns(); 393 | } 394 | }; 395 | 396 | /** 397 | * Destroys the directive. Takes care of cleaning all 398 | * watchers and event handlers. 399 | * 400 | */ 401 | Deckgrid.prototype.destroy = function destroy () { 402 | var i = this.$$watchers.length - 1; 403 | 404 | for (i; i >= 0; i = i - 1) { 405 | this.$$watchers[i](); 406 | } 407 | }; 408 | 409 | return { 410 | create : function create (scope, element) { 411 | return new Deckgrid(scope, element); 412 | } 413 | }; 414 | } 415 | ]); 416 | -------------------------------------------------------------------------------- /deepdream/scripts/angular-deckgrid.min.js: -------------------------------------------------------------------------------- 1 | /*! angular-deckgrid (v0.5.0) - Copyright: 2013 - 2014, André König (andre.koenig@posteo.de) - MIT */ 2 | angular.module("akoenig.deckgrid",[]),angular.module("akoenig.deckgrid").directive("deckgrid",["DeckgridDescriptor",function(a){"use strict";return a.create()}]),angular.module("akoenig.deckgrid").factory("DeckgridDescriptor",["Deckgrid","$templateCache",function(a,b){"use strict";function c(){this.restrict="AE",this.template='
',this.scope={model:"=source"},this.$$deckgrid=null,this.transclude=!0,this.link=this.$$link.bind(this),this.$$templateKeyIndex=0}return c.prototype.$$destroy=function(){this.$$deckgrid.destroy()},c.prototype.$$link=function(c,d,e,f,g){var h="deckgrid/innerHtmlTemplate"+ ++this.$$templateKeyIndex+".html";c.$on("$destroy",this.$$destroy.bind(this)),angular.isUndefined(e.cardtemplate)?(angular.isUndefined(e.cardtemplatestring)?g(c,function(a){var c,d=[],e=0,f=a.length;for(e;f>e;e+=1)c=a[e].outerHTML,angular.isDefined(c)&&d.push(c);b.put(h,d.join())}):b.put(h,d.attr("cardtemplatestring")),c.cardTemplate=h):c.cardTemplate=e.cardtemplate,c.mother=c.$parent,this.$$deckgrid=a.create(c,d[0])},{create:function(){return new c}}}]),angular.module("akoenig.deckgrid").factory("Deckgrid",["$window","$log",function(a,b){"use strict";function c(b,c){var d,e,f=this;this.$$elem=c,this.$$watchers=[],this.$$scope=b,this.$$scope.columns=[],this.$$scope.layout=this.$$getLayout(),this.$$createColumns(),d=this.$$scope.$watchCollection("model",this.$$onModelChange.bind(this)),this.$$watchers.push(d),angular.forEach(f.$$getMediaQueries(),function(a){function b(){a.removeListener(c)}var c=f.$$onMediaQueryChange.bind(f);a.addListener(c),f.$$watchers.push(b)}),e=a.matchMedia("(orientation: portrait)"),e.addListener(f.$$onMediaQueryChange.bind(f))}return c.prototype.$$getMediaQueries=function(){function b(a){try{return a.sheet.cssRules||[]}catch(b){return[]}}function c(a){var b=/\[(\w*-)?deckgrid\]::?before/g,c=0,d="";if(!a.media||angular.isUndefined(a.cssRules))return!1;for(c=a.cssRules.length-1;c>=0;c-=1)if(d=a.cssRules[c].selectorText,angular.isDefined(d)&&d.match(b))return!0;return!1}var d=[],e=[];return d=Array.prototype.concat.call(Array.prototype.slice.call(document.querySelectorAll("style[type='text/css']")),Array.prototype.slice.call(document.querySelectorAll("link[rel='stylesheet']"))),angular.forEach(d,function(d){var f=b(d);angular.forEach(f,function(b){c(b)&&e.push(a.matchMedia(b.media.mediaText))})}),e},c.prototype.$$createColumns=function(){var a=this;return this.$$scope.layout?(this.$$scope.columns=[],void angular.forEach(this.$$scope.model,function(b,c){var d=c%a.$$scope.layout.columns|0;a.$$scope.columns[d]||(a.$$scope.columns[d]=[]),b.$index=c,a.$$scope.columns[d].push(b)})):b.error("angular-deckgrid: No CSS configuration found (see https://github.com/akoenig/angular-deckgrid#the-grid-configuration)")},c.prototype.$$getLayout=function(){var b,c=a.getComputedStyle(this.$$elem,":before").content;return c&&(c=c.replace(/'/g,""),c=c.replace(/"/g,""),c=c.split(" "),2===c.length&&(b={},b.columns=0|c[0],b.classList=c[1].replace(/\./g," ").trim())),b},c.prototype.$$onMediaQueryChange=function(){var a=this,b=this.$$getLayout();b.columns!==this.$$scope.layout.columns&&(a.$$scope.layout=b,a.$$scope.$apply(function(){a.$$createColumns()}))},c.prototype.$$onModelChange=function(a,b){var c=this;a=a||[],b=b||[],angular.equals(b,a)||c.$$createColumns()},c.prototype.destroy=function(){var a=this.$$watchers.length-1;for(a;a>=0;a-=1)this.$$watchers[a]()},{create:function(a,b){return new c(a,b)}}}]); -------------------------------------------------------------------------------- /deepdream/scripts/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-deckgrid-demo 3 | * 4 | * Copyright(c) 2013 André König 5 | * MIT Licensed 6 | * 7 | */ 8 | 9 | /** 10 | * @author André König (andre.koenig@posteo.de) 11 | * 12 | */ 13 | 14 | angular.module('akoenig.deckgrid.demo', [ 15 | 'ngRoute', 16 | 'akoenig.deckgrid' 17 | ]); 18 | 19 | angular.module('akoenig.deckgrid.demo').config([ 20 | 21 | '$routeProvider', 22 | 23 | function configure ($routeProvider) { 24 | 25 | 'use strict'; 26 | 27 | $routeProvider.when('/', { 28 | controller: 'HomeController', 29 | templateUrl: 'templates/home.html' 30 | }); 31 | 32 | } 33 | ]); -------------------------------------------------------------------------------- /deepdream/scripts/controllers/home.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-deckgrid-demo 3 | * 4 | * Copyright(c) 2013 André König 5 | * MIT Licensed 6 | * 7 | */ 8 | 9 | /** 10 | * @author André König (andre.koenig@posteo.de) 11 | * 12 | */ 13 | 14 | angular.module('akoenig.deckgrid.demo').controller('HomeController', [ 15 | 16 | '$scope', 17 | '$http', 18 | '$location', 19 | 20 | function initialize ($scope,$http,$location) { 21 | 22 | 'use strict'; 23 | 24 | var url = '/images.json'; 25 | //var url = 'http://deepdream.vision.ai/images.json'; 26 | 27 | 28 | var searchObject = $location.search(); 29 | //console.log('searchObj is',searchObject); 30 | var N = searchObject.N || 20; 31 | N = Math.max(Math.min(N,100),1); 32 | 33 | $http.get(url).success(function(data) { 34 | if (searchObject.latest) { 35 | $scope.photos = data.slice(-N); 36 | $scope.photos = $scope.photos.reverse(); 37 | } else { 38 | $scope.photos = _.sample(data,N); 39 | } 40 | }).error(function() { 41 | $scope.photos = []; 42 | }); 43 | /* 44 | $scope.photos = [ 45 | {id:'photo-0', name:'2008_000145.jpg',src:'http://deepdream.vision.ai/2008_000145.jpg'}, 46 | {id: 'photo-1', name: 'Awesome photo', src: 'http://lorempixel.com/400/300/abstract'}, 47 | {id: 'photo-2', name: 'Great photo', src: 'http://lorempixel.com/450/400/city'}, 48 | {id: 'photo-3', name: 'Strange photo', src: 'http://lorempixel.com/400/300/people'}, 49 | {id: 'photo-4', name: 'A photo?', src: 'http://lorempixel.com/400/300/transport'}, 50 | {id: 'photo-5', name: 'What a photo', src: 'http://lorempixel.com/450/300/fashion'}, 51 | {id: 'photo-6', name: 'Silly photo', src: 'http://lorempixel.com/400/300/technics'}, 52 | {id: 'photo-7', name: 'Weird photo', src: 'http://lorempixel.com/410/350/sports'}, 53 | {id: 'photo-8', name: 'Modern photo', src: 'http://lorempixel.com/400/300/nightlife'}, 54 | {id: 'photo-9', name: 'Classical photo', src: 'http://lorempixel.com/400/300/nature'}, 55 | {id: 'photo-10', name: 'Dynamic photo', src: 'http://lorempixel.com/420/300/abstract'}, 56 | {id: 'photo-11', name: 'Neat photo', src: 'http://lorempixel.com/400/300/sports'}, 57 | {id: 'photo-12', name: 'Bumpy photo', src: 'http://lorempixel.com/400/300/nightlife'}, 58 | {id: 'photo-13', name: 'Brilliant photo', src: 'http://lorempixel.com/400/380/nature'}, 59 | {id: 'photo-14', name: 'Excellent photo', src: 'http://lorempixel.com/480/300/technics'}, 60 | {id: 'photo-15', name: 'Gorgeous photo', src: 'http://lorempixel.com/400/300/sports'}, 61 | {id: 'photo-16', name: 'Lovely photo', src: 'http://lorempixel.com/400/300/nightlife'}, 62 | {id: 'photo-17', name: 'A "wow" photo', src: 'http://lorempixel.com/400/300/nature'}, 63 | {id: 'photo-18', name: 'Bodacious photo', src: 'http://lorempixel.com/400/300/abstract'} 64 | ]; 65 | */ 66 | 67 | } 68 | 69 | ]); 70 | -------------------------------------------------------------------------------- /deepdream/scripts/controllers/home.js~: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-deckgrid-demo 3 | * 4 | * Copyright(c) 2013 André König 5 | * MIT Licensed 6 | * 7 | */ 8 | 9 | /** 10 | * @author André König (andre.koenig@posteo.de) 11 | * 12 | */ 13 | 14 | angular.module('akoenig.deckgrid.demo').controller('HomeController', [ 15 | 16 | '$scope', 17 | '$http', 18 | '$location', 19 | 20 | function initialize ($scope,$http,$location) { 21 | 22 | 'use strict'; 23 | 24 | var url = '/images/images.json'; 25 | //var url = 'http://deepdream.vision.ai/images.json'; 26 | 27 | 28 | var searchObject = $location.search(); 29 | //console.log('searchObj is',searchObject); 30 | var N = searchObject.N || 8; 31 | N = Math.max(Math.min(N,20),1); 32 | 33 | $http.get(url).success(function(data) { 34 | if (searchObject.latest) { 35 | $scope.photos = data.slice(-N); 36 | } else { 37 | $scope.photos = _.sample(data,N); 38 | } 39 | }).error(function() { 40 | $scope.photos = []; 41 | }); 42 | /* 43 | $scope.photos = [ 44 | {id:'photo-0', name:'2008_000145.jpg',src:'http://deepdream.vision.ai/2008_000145.jpg'}, 45 | {id: 'photo-1', name: 'Awesome photo', src: 'http://lorempixel.com/400/300/abstract'}, 46 | {id: 'photo-2', name: 'Great photo', src: 'http://lorempixel.com/450/400/city'}, 47 | {id: 'photo-3', name: 'Strange photo', src: 'http://lorempixel.com/400/300/people'}, 48 | {id: 'photo-4', name: 'A photo?', src: 'http://lorempixel.com/400/300/transport'}, 49 | {id: 'photo-5', name: 'What a photo', src: 'http://lorempixel.com/450/300/fashion'}, 50 | {id: 'photo-6', name: 'Silly photo', src: 'http://lorempixel.com/400/300/technics'}, 51 | {id: 'photo-7', name: 'Weird photo', src: 'http://lorempixel.com/410/350/sports'}, 52 | {id: 'photo-8', name: 'Modern photo', src: 'http://lorempixel.com/400/300/nightlife'}, 53 | {id: 'photo-9', name: 'Classical photo', src: 'http://lorempixel.com/400/300/nature'}, 54 | {id: 'photo-10', name: 'Dynamic photo', src: 'http://lorempixel.com/420/300/abstract'}, 55 | {id: 'photo-11', name: 'Neat photo', src: 'http://lorempixel.com/400/300/sports'}, 56 | {id: 'photo-12', name: 'Bumpy photo', src: 'http://lorempixel.com/400/300/nightlife'}, 57 | {id: 'photo-13', name: 'Brilliant photo', src: 'http://lorempixel.com/400/380/nature'}, 58 | {id: 'photo-14', name: 'Excellent photo', src: 'http://lorempixel.com/480/300/technics'}, 59 | {id: 'photo-15', name: 'Gorgeous photo', src: 'http://lorempixel.com/400/300/sports'}, 60 | {id: 'photo-16', name: 'Lovely photo', src: 'http://lorempixel.com/400/300/nightlife'}, 61 | {id: 'photo-17', name: 'A "wow" photo', src: 'http://lorempixel.com/400/300/nature'}, 62 | {id: 'photo-18', name: 'Bodacious photo', src: 'http://lorempixel.com/400/300/abstract'} 63 | ]; 64 | */ 65 | 66 | } 67 | 68 | ]); 69 | -------------------------------------------------------------------------------- /deepdream/scripts/directives/imageloaded.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-deckgrid-demo 3 | * 4 | * Copyright(c) 2013 André König 5 | * MIT Licensed 6 | * 7 | */ 8 | 9 | /** 10 | * @author André König (andre.koenig@posteo.de) 11 | * 12 | */ 13 | 14 | angular.module('akoenig.deckgrid.demo').directive('imageloaded', [ 15 | 16 | function () { 17 | 18 | 'use strict'; 19 | 20 | return { 21 | restrict: 'A', 22 | 23 | link: function(scope, element, attrs) { 24 | var cssClass = attrs.loadedclass; 25 | 26 | element.bind('load', function (e) { 27 | angular.element(element).addClass(cssClass); 28 | }); 29 | } 30 | } 31 | } 32 | ]); -------------------------------------------------------------------------------- /deepdream/scripts/vendor/angular-route.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.3.2-build.3508+sha.e4eb382 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(p,e,B){'use strict';function u(q,h,f){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,b,c,g,x){function y(){k&&(f.cancel(k),k=null);l&&(l.$destroy(),l=null);m&&(k=f.leave(m),k.then(function(){k=null}),m=null)}function w(){var c=q.current&&q.current.locals;if(e.isDefined(c&&c.$template)){var c=a.$new(),g=q.current;m=x(c,function(c){f.enter(c,null,m||b).then(function(){!e.isDefined(s)||s&&!a.$eval(s)||h()});y()});l=g.scope=c;l.$emit("$viewContentLoaded"); 7 | l.$eval(v)}else y()}var l,m,k,s=c.autoscroll,v=c.onload||"";a.$on("$routeChangeSuccess",w);w()}}}function z(e,h,f){return{restrict:"ECA",priority:-400,link:function(a,b){var c=f.current,g=c.locals;b.html(g.$template);var x=e(b.contents());c.controller&&(g.$scope=a,g=h(c.controller,g),c.controllerAs&&(a[c.controllerAs]=g),b.data("$ngControllerController",g),b.children().data("$ngControllerController",g));x(a)}}}p=e.module("ngRoute",["ng"]).provider("$route",function(){function q(a,b){return e.extend(new (e.extend(function(){}, 8 | {prototype:a})),b)}function h(a,e){var c=e.caseInsensitiveMatch,g={originalPath:a,regexp:a},f=g.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,e,c,b){a="?"===b?b:null;b="*"===b?b:null;f.push({name:c,optional:!!a});e=e||"";return""+(a?"":e)+"(?:"+(a?e:"")+(b&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");g.regexp=new RegExp("^"+a+"$",c?"i":"");return g}var f={};this.when=function(a,b){f[a]=e.extend({reloadOnSearch:!0},b,a&&h(a,b));if(a){var c= 9 | "/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";f[c]=e.extend({redirectTo:a},h(c,b))}return this};this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,b,c,g,h,p,w){function l(b){var d=r.current;(u=(n=k())&&d&&n.$$route===d.$$route&&e.equals(n.pathParams,d.pathParams)&&!n.reloadOnSearch&&!v)||!d&&!n||a.$broadcast("$routeChangeStart",n,d).defaultPrevented&& 10 | b&&b.preventDefault()}function m(){var t=r.current,d=n;if(u)t.params=d.params,e.copy(t.params,c),a.$broadcast("$routeUpdate",t);else if(d||t)v=!1,(r.current=d)&&d.redirectTo&&(e.isString(d.redirectTo)?b.path(s(d.redirectTo,d.params)).search(d.params).replace():b.url(d.redirectTo(d.pathParams,b.path(),b.search())).replace()),g.when(d).then(function(){if(d){var a=e.extend({},d.resolve),b,c;e.forEach(a,function(d,b){a[b]=e.isString(d)?h.get(d):h.invoke(d,null,null,b)});e.isDefined(b=d.template)?e.isFunction(b)&& 11 | (b=b(d.params)):e.isDefined(c=d.templateUrl)&&(e.isFunction(c)&&(c=c(d.params)),c=w.getTrustedResourceUrl(c),e.isDefined(c)&&(d.loadedTemplateUrl=c,b=p(c)));e.isDefined(b)&&(a.$template=b);return g.all(a)}}).then(function(b){d==r.current&&(d&&(d.locals=b,e.copy(d.params,c)),a.$broadcast("$routeChangeSuccess",d,t))},function(b){d==r.current&&a.$broadcast("$routeChangeError",d,t,b)})}function k(){var a,d;e.forEach(f,function(c,g){var f;if(f=!d){var h=b.path();f=c.keys;var l={};if(c.regexp)if(h=c.regexp.exec(h)){for(var k= 12 | 1,m=h.length;kt&&!o||!u||r&&!i&&f||e&&f)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n); 8 | }function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r=F&&gu&&lu?new Dn(t):null,c=t.length;a&&(i=Mn,f=false,t=a);n:for(;++oi(t,a,0)&&u.push(a);return u}function at(n,t){var r=true;return Su(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ct(n,t,r,e){var u=e,o=u;return Su(n,function(n,i,f){i=+t(n,i,f),(r(i,u)||i===e&&i===o)&&(u=i, 14 | o=n)}),o}function lt(n,t){var r=[];return Su(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function st(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function pt(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++ut&&(t=-t>u?0:u+t),r=r===w||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Be(u);++e=c)break n;o=e[o],u*="asc"===o||true===o?1:-1;break n}u=t.b-r.b}return u})}function $t(n,t){ 21 | var r=0;return Su(n,function(n,e,u){r+=+t(n,e,u)||0}),r}function St(n,t){var e=-1,u=xr(),o=n.length,i=u==r,f=i&&o>=F,a=f&&gu&&lu?new Dn(void 0):null,c=[];a?(u=Mn,i=false):(f=false,a=t?[]:c);n:for(;++eu(a,s,0)&&((t||f)&&a.push(s),c.push(l))}return c}function Ft(n,t){for(var r=-1,e=t.length,u=Be(e);++r>>1,i=n[o];(r?i<=t:iu?w:o,u=1);++e=F)return t.plant(e).value();for(var u=0,n=r?o[u].apply(this,n):e;++uarguments.length;return typeof e=="function"&&o===w&&Oo(r)?n(r,e,u,i):Ot(r,wr(e,o,4),u,i,t)}}function sr(n,t,r,e,u,o,i,f,a,c){function l(){for(var m=arguments.length,b=m,j=Be(m);b--;)j[b]=arguments[b];if(e&&(j=Mt(j,e,u)),o&&(j=qt(j,o,i)),_||y){var b=l.placeholder,k=v(j,b),m=m-k.length;if(mt?0:t)):[]}function Pr(n,t,r){var e=n?n.length:0;return e?((r?Ur(n,t,r):null==t)&&(t=1),t=e-(+t||0),Et(n,0,0>t?0:t)):[]}function Kr(n){return n?n[0]:w}function Vr(n,t,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?bu(u+e,0):e;else if(e)return e=Lt(n,t), 42 | er?bu(u+r,0):r||0,typeof n=="string"||!Oo(n)&&be(n)?r<=u&&-1t?0:+t||0,e);++r=n&&(t=w),r}}function ae(n,t,r){function e(t,r){r&&iu(r),a=p=h=w,t&&(_=ho(),c=n.apply(s,f),p||a||(f=s=w))}function u(){var n=t-(ho()-l);0>=n||n>t?e(h,a):p=su(u,n)}function o(){e(g,p); 46 | }function i(){if(f=arguments,l=ho(),s=this,h=g&&(p||!y),false===v)var r=y&&!p;else{a||y||(_=l);var e=v-(l-_),i=0>=e||e>v;i?(a&&(a=iu(a)),_=l,c=n.apply(s,f)):a||(a=su(o,e))}return i&&p?p=iu(p):p||t===v||(p=su(u,t)),r&&(i=true,c=n.apply(s,f)),!i||p||a||(f=s=w),c}var f,a,c,l,s,p,h,_=0,v=false,g=true;if(typeof n!="function")throw new Ge(L);if(t=0>t?0:+t||0,true===r)var y=true,g=false;else ge(r)&&(y=!!r.leading,v="maxWait"in r&&bu(+r.maxWait||0,t),g="trailing"in r?!!r.trailing:g);return i.cancel=function(){p&&iu(p),a&&iu(a), 47 | _=0,a=p=h=w},i}function ce(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new Ge(L);return r.cache=new ce.Cache,r}function le(n,t){if(typeof n!="function")throw new Ge(L);return t=bu(t===w?n.length-1:+t||0,0),function(){for(var r=arguments,e=-1,u=bu(r.length-t,0),o=Be(u);++et}function pe(n){return h(n)&&Er(n)&&nu.call(n,"callee")&&!cu.call(n,"callee")}function he(n,t,r,e){return e=(r=typeof r=="function"?Bt(r,e,3):w)?r(n,t):w,e===w?dt(n,t,r):!!e}function _e(n){return h(n)&&typeof n.message=="string"&&ru.call(n)==P}function ve(n){return ge(n)&&ru.call(n)==K}function ge(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ye(n){ 49 | return null==n?false:ve(n)?uu.test(Qe.call(n)):h(n)&&Rn.test(n)}function de(n){return typeof n=="number"||h(n)&&ru.call(n)==V}function me(n){var t;if(!h(n)||ru.call(n)!=Z||pe(n)||!(nu.call(n,"constructor")||(t=n.constructor,typeof t!="function"||t instanceof t)))return false;var r;return ht(n,function(n,t){r=t}),r===w||nu.call(n,r)}function we(n){return ge(n)&&ru.call(n)==Y}function be(n){return typeof n=="string"||h(n)&&ru.call(n)==G}function xe(n){return h(n)&&Sr(n.length)&&!!Sn[ru.call(n)]}function Ae(n,t){ 50 | return nt||!n||!mu(t))return r;do t%2&&(r+=n),t=yu(t/2),n+=n;while(t);return r}function We(n,t,r){var e=n;return(n=u(n))?(r?Ur(e,t,r):null==t)?n.slice(g(n),y(n)+1):(t+="",n.slice(o(n,t),i(n,t)+1)):n}function $e(n,t,r){return r&&Ur(n,t,r)&&(t=w),n=u(n),n.match(t||Wn)||[]}function Se(n,t,r){return r&&Ur(n,t,r)&&(t=w),h(n)?Ne(n):ut(n,t)}function Fe(n){ 52 | return n}function Ne(n){return bt(ot(n,true))}function Te(n,t,r){if(null==r){var e=ge(t),u=e?zo(t):w;((u=u&&u.length?gt(t,u):w)?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=gt(t,zo(t)));var o=true,e=-1,i=ve(n),f=u.length;false===r?o=false:ge(r)&&"chain"in r&&(o=r.chain);for(;++e=$)return r}else n=0;return Lu(r,e)}}(),Mu=le(function(n,t){ 55 | return h(n)&&Er(n)?ft(n,pt(t,false,true)):[]}),qu=tr(),Pu=tr(true),Ku=le(function(n){for(var t=n.length,e=t,u=Be(l),o=xr(),i=o==r,f=[];e--;){var a=n[e]=Er(a=n[e])?a:[];u[e]=i&&120<=a.length&&gu&&lu?new Dn(e&&a):null}var i=n[0],c=-1,l=i?i.length:0,s=u[0];n:for(;++c(s?Mn(s,a):o(f,a,0))){for(e=t;--e;){var p=u[e];if(0>(p?Mn(p,a):o(n[e],a,0)))continue n}s&&s.push(a),f.push(a)}return f}),Vu=le(function(t,r){r=pt(r);var e=rt(t,r);return It(t,r.sort(n)),e}),Zu=vr(),Yu=vr(true),Gu=le(function(n){return St(pt(n,false,true)); 56 | }),Ju=le(function(n,t){return Er(n)?ft(n,t):[]}),Xu=le(Jr),Hu=le(function(n){var t=n.length,r=2--n?t.apply(this,arguments):void 0}},Nn.ary=function(n,t,r){return r&&Ur(n,t,r)&&(t=w),t=n&&null==t?n.length:bu(+t||0,0),gr(n,E,w,w,w,w,t)},Nn.assign=Co,Nn.at=no,Nn.before=fe,Nn.bind=_o,Nn.bindAll=vo,Nn.bindKey=go,Nn.callback=Se,Nn.chain=Qr,Nn.chunk=function(n,t,r){t=(r?Ur(n,t,r):null==t)?1:bu(yu(t)||1,1),r=0;for(var e=n?n.length:0,u=-1,o=Be(vu(e/t));rr&&(r=-r>u?0:u+r),e=e===w||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;rt?0:t)):[]},Nn.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?Ur(n,t,r):null==t)&&(t=1),t=e-(+t||0),Et(n,0>t?0:t)):[]},Nn.takeRightWhile=function(n,t,r){ 71 | return n&&n.length?Nt(n,wr(t,r,3),false,true):[]},Nn.takeWhile=function(n,t,r){return n&&n.length?Nt(n,wr(t,r,3)):[]},Nn.tap=function(n,t,r){return t.call(r,n),n},Nn.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Ge(L);return false===r?e=false:ge(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ae(n,t,{leading:e,maxWait:+t,trailing:u})},Nn.thru=ne,Nn.times=function(n,t,r){if(n=yu(n),1>n||!mu(n))return[];var e=-1,u=Be(xu(n,4294967295));for(t=Bt(t,r,1);++ee?u[e]=t(e):t(e); 72 | return u},Nn.toArray=je,Nn.toPlainObject=ke,Nn.transform=function(n,t,r,e){var u=Oo(n)||xe(n);return t=wr(t,e,4),null==r&&(u||ge(n)?(e=n.constructor,r=u?Oo(n)?new e:[]:$u(ve(e)?e.prototype:w)):r={}),(u?Pn:_t)(n,function(n,e,u){return t(r,n,e,u)}),r},Nn.union=Gu,Nn.uniq=Gr,Nn.unzip=Jr,Nn.unzipWith=Xr,Nn.values=Ee,Nn.valuesIn=function(n){return Ft(n,Re(n))},Nn.where=function(n,t){return re(n,bt(t))},Nn.without=Ju,Nn.wrap=function(n,t){return t=null==t?Fe:t,gr(t,R,w,[n],[])},Nn.xor=function(){for(var n=-1,t=arguments.length;++nr?0:+r||0,e),r-=t.length,0<=r&&n.indexOf(t,r)==r},Nn.escape=function(n){return(n=u(n))&&hn.test(n)?n.replace(sn,c):n},Nn.escapeRegExp=function(n){return(n=u(n))&&bn.test(n)?n.replace(wn,l):n||"(?:)"},Nn.every=te,Nn.find=ro,Nn.findIndex=qu,Nn.findKey=$o,Nn.findLast=eo, 75 | Nn.findLastIndex=Pu,Nn.findLastKey=So,Nn.findWhere=function(n,t){return ro(n,bt(t))},Nn.first=Kr,Nn.floor=ni,Nn.get=function(n,t,r){return n=null==n?w:yt(n,Dr(t),t+""),n===w?r:n},Nn.gt=se,Nn.gte=function(n,t){return n>=t},Nn.has=function(n,t){if(null==n)return false;var r=nu.call(n,t);if(!r&&!Wr(t)){if(t=Dr(t),n=1==t.length?n:yt(n,Et(t,0,-1)),null==n)return false;t=Zr(t),r=nu.call(n,t)}return r||Sr(n.length)&&Cr(t,n.length)&&(Oo(n)||pe(n))},Nn.identity=Fe,Nn.includes=ee,Nn.indexOf=Vr,Nn.inRange=function(n,t,r){ 76 | return t=+t||0,r===w?(r=t,t=0):r=+r||0,n>=xu(t,r)&&nr?bu(e+r,0):xu(r||0,e-1))+1;else if(r)return u=Lt(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1; 78 | if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Nn.lt=Ae,Nn.lte=function(n,t){return n<=t},Nn.max=ti,Nn.min=ri,Nn.noConflict=function(){return Zn._=eu,this},Nn.noop=Le,Nn.now=ho,Nn.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Nn.sum=function(n,t,r){if(r&&Ur(n,t,r)&&(t=w),t=wr(t,r,3),1==t.length){n=Oo(n)?n:zr(n),r=n.length;for(var e=0;r--;)e+=+t(n[r])||0;n=e}else n=$t(n,t);return n},Nn.template=function(n,t,r){var e=Nn.templateSettings;r&&Ur(n,t,r)&&(t=r=w),n=u(n),t=nt(tt({},r||t),e,Qn),r=nt(tt({},t.imports),e.imports,Qn); 81 | var o,i,f=zo(r),a=Ft(r,f),c=0;r=t.interpolate||Cn;var l="__p+='";r=Ze((t.escape||Cn).source+"|"+r.source+"|"+(r===gn?jn:Cn).source+"|"+(t.evaluate||Cn).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),l+=n.slice(c,a).replace(Un,s),r&&(o=true,l+="'+__e("+r+")+'"),f&&(i=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(fn,""):l).replace(an,"$1").replace(cn,"$1;"), 82 | l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Jo(function(){return qe(f,p+"return "+l).apply(w,a)}),t.source=l,_e(t))throw t;return t},Nn.trim=We,Nn.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?Ur(e,t,r):null==t)?g(n):o(n,t+"")):n},Nn.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?Ur(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,i(n,t+"")+1):n; 83 | },Nn.trunc=function(n,t,r){r&&Ur(n,t,r)&&(t=w);var e=U;if(r=W,null!=t)if(ge(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0;if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==o)return t+r;if(we(o)){if(n.slice(e).search(o)){var i,f=n.slice(0,e);for(o.global||(o=Ze(o.source,(kn.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o), 84 | -1u.__dir__?"Right":"")}),u},zn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),Pn(["filter","map","takeWhile"],function(n,t){ 86 | var r=t+1,e=r!=T;zn.prototype[n]=function(n,t){var u=this.clone();return u.__iteratees__.push({iteratee:wr(n,t,1),type:r}),u.__filtered__=u.__filtered__||e,u}}),Pn(["first","last"],function(n,t){var r="take"+(t?"Right":"");zn.prototype[n]=function(){return this[r](1).value()[0]}}),Pn(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");zn.prototype[n]=function(){return this.__filtered__?new zn(this):this[r](1)}}),Pn(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?bt:ze;zn.prototype[n]=function(n){ 87 | return this[r](e(n))}}),zn.prototype.compact=function(){return this.filter(Fe)},zn.prototype.reject=function(n,t){return n=wr(n,t,1),this.filter(function(t){return!n(t)})},zn.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=this;return r.__filtered__&&(0t)?new zn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==w&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r)},zn.prototype.takeRightWhile=function(n,t){return this.reverse().takeWhile(n,t).reverse()},zn.prototype.toArray=function(){return this.take(Ru); 88 | },_t(zn.prototype,function(n,t){var r=/^(?:filter|map|reject)|While$/.test(t),e=/^(?:first|last)$/.test(t),u=Nn[e?"take"+("last"==t?"Right":""):t];u&&(Nn.prototype[t]=function(){function t(n){return e&&i?u(n,1)[0]:u.apply(w,Jn([n],o))}var o=e?[1]:arguments,i=this.__chain__,f=this.__wrapped__,a=!!this.__actions__.length,c=f instanceof zn,l=o[0],s=c||Oo(f);return s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false),l={func:ne,args:[t],thisArg:w},a=c&&!a,e&&!i?a?(f=f.clone(),f.__actions__.push(l),n.call(f)):u.call(w,this.value())[0]:!e&&s?(f=a?f:new zn(this), 89 | f=n.apply(f,o),f.__actions__.push(l),new Ln(f,i)):this.thru(t)})}),Pn("join pop push replace shift sort splice split unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?He:Je)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);Nn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),_t(zn.prototype,function(n,t){var r=Nn[t];if(r){var e=r.name;(Wu[e]||(Wu[e]=[])).push({ 90 | name:t,func:r})}}),Wu[sr(w,A).name]=[{name:"wrapper",func:w}],zn.prototype.clone=function(){var n=new zn(this.__wrapped__);return n.__actions__=qn(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=qn(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=qn(this.__views__),n},zn.prototype.reverse=function(){if(this.__filtered__){var n=new zn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},zn.prototype.value=function(){ 91 | var n,t=this.__wrapped__.value(),r=this.__dir__,e=Oo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,a=-1,c=i.length;++ar.__dir__?n:n.reverse()}var t=this.__wrapped__; 93 | if(t instanceof zn){var r=t;return this.__actions__.length&&(r=new zn(this)),r=r.reverse(),r.__actions__.push({func:ne,args:[n],thisArg:w}),new Ln(r,this.__chain__)}return this.thru(n)},Nn.prototype.toString=function(){return this.value()+""},Nn.prototype.run=Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return Tt(this.__wrapped__,this.__actions__)},Nn.prototype.collect=Nn.prototype.map,Nn.prototype.head=Nn.prototype.first,Nn.prototype.select=Nn.prototype.filter,Nn.prototype.tail=Nn.prototype.rest, 94 | Nn}var w,b="3.10.0",x=1,A=2,j=4,k=8,I=16,R=32,O=64,E=128,C=256,U=30,W="...",$=150,S=16,F=200,N=1,T=2,L="Expected a function",z="__lodash_placeholder__",B="[object Arguments]",D="[object Array]",M="[object Boolean]",q="[object Date]",P="[object Error]",K="[object Function]",V="[object Number]",Z="[object Object]",Y="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nn="[object Int16Array]",tn="[object Int32Array]",rn="[object Uint8Array]",en="[object Uint8ClampedArray]",un="[object Uint16Array]",on="[object Uint32Array]",fn=/\b__p\+='';/g,an=/\b(__p\+=)''\+/g,cn=/(__e\(.*?\)|\b__t\))\+'';/g,ln=/&(?:amp|lt|gt|quot|#39|#96);/g,sn=/[&<>"'`]/g,pn=RegExp(ln.source),hn=RegExp(sn.source),_n=/<%-([\s\S]+?)%>/g,vn=/<%([\s\S]+?)%>/g,gn=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,dn=/^\w*$/,mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,wn=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,bn=RegExp(wn.source),xn=/[\u0300-\u036f\ufe20-\ufe23]/g,An=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kn=/\w*$/,In=/^0[xX]/,Rn=/^\[object .+?Constructor\]$/,On=/^\d+$/,En=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Cn=/($^)/,Un=/['\n\r\u2028\u2029\\]/g,Wn=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),$n="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout isFinite parseFloat parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap".split(" "),Sn={}; 95 | Sn[X]=Sn[H]=Sn[Q]=Sn[nn]=Sn[tn]=Sn[rn]=Sn[en]=Sn[un]=Sn[on]=true,Sn[B]=Sn[D]=Sn[J]=Sn[M]=Sn[q]=Sn[P]=Sn[K]=Sn["[object Map]"]=Sn[V]=Sn[Z]=Sn[Y]=Sn["[object Set]"]=Sn[G]=Sn["[object WeakMap]"]=false;var Fn={};Fn[B]=Fn[D]=Fn[J]=Fn[M]=Fn[q]=Fn[X]=Fn[H]=Fn[Q]=Fn[nn]=Fn[tn]=Fn[V]=Fn[Z]=Fn[Y]=Fn[G]=Fn[rn]=Fn[en]=Fn[un]=Fn[on]=true,Fn[P]=Fn[K]=Fn["[object Map]"]=Fn["[object Set]"]=Fn["[object WeakMap]"]=false;var Nn={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a", 96 | "\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y", 97 | "\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Tn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ln={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},zn={"function":true,object:true},Bn={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Dn={"\\":"\\", 98 | "'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mn=zn[typeof exports]&&exports&&!exports.nodeType&&exports,qn=zn[typeof module]&&module&&!module.nodeType&&module,Pn=zn[typeof self]&&self&&self.Object&&self,Kn=zn[typeof window]&&window&&window.Object&&window,Vn=qn&&qn.exports===Mn&&Mn,Zn=Mn&&qn&&typeof global=="object"&&global&&global.Object&&global||Kn!==(this&&this.window)&&Kn||Pn||this,Yn=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Zn._=Yn, define(function(){ 99 | return Yn})):Mn&&qn?Vn?(qn.exports=Yn)._=Yn:Mn._=Yn:Zn._=Yn}).call(this); -------------------------------------------------------------------------------- /deepdream/serve_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Serve the entire directory using NGINX on port 80 3 | 4 | cd `dirname $0` 5 | docker run --name deepdream-files -v `pwd`:/usr/share/nginx/html:ro -d -p 80:80 nginx 6 | cd - 2>/dev/null 7 | -------------------------------------------------------------------------------- /deepdream/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "maxwidth" : 400, 3 | "layer" : "inception_4c/output" 4 | } 5 | -------------------------------------------------------------------------------- /deepdream/styles/images/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream/styles/images/spinner.gif -------------------------------------------------------------------------------- /deepdream/styles/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-deckgrid-demo 3 | * 4 | * Copyright(c) 2013 André König 5 | * MIT Licensed 6 | * 7 | */ 8 | 9 | /** 10 | * @author André König (andre.koenig@posteo.de) 11 | * 12 | */ 13 | 14 | body { 15 | background:rgba(0, 0, 0, .04); 16 | font-family: 'Open Sans', sans-serif; 17 | padding-bottom:50px; 18 | } 19 | 20 | a { 21 | color:#000; 22 | text-decoration:none; 23 | } 24 | 25 | a:visited { 26 | color:rgba(0, 0, 0, .5); 27 | } 28 | 29 | h1 { 30 | font-size:320%; 31 | margin-bottom:30px; 32 | } 33 | 34 | h2 { 35 | opacity:.8; 36 | } 37 | 38 | p { 39 | font-size:80%; 40 | opacity:.5; 41 | } 42 | 43 | h1, h2, h3, h4 { 44 | font-weight:100; 45 | margin:0; 46 | padding:0; 47 | } 48 | 49 | img { 50 | height:auto; 51 | max-width:100%; 52 | } 53 | 54 | .animation-fade { 55 | opacity:0; 56 | } 57 | 58 | .animation-faded { 59 | opacity:1; 60 | } 61 | 62 | .animation-faded { 63 | -webkit-transition: opacity 1s linear .2s; 64 | -moz-transition: opacity 1s linear .2s; 65 | -o-transition: opacity 1s linear .2s; 66 | transition: opacity 1s linear .2s; 67 | } 68 | 69 | .balloon-wrapper { 70 | padding-top:30px; 71 | opacity:1; 72 | text-align:center; 73 | } 74 | 75 | .balloon { 76 | background:#3498db; 77 | border-radius:50%; 78 | display:inline-block; 79 | font-size:160%; 80 | text-align:center; 81 | height:100px; 82 | line-height:100px; 83 | width:100px; 84 | } 85 | 86 | .button { 87 | border:3px solid #000; 88 | border-radius:8px; 89 | color:#000; 90 | display:inline-block; 91 | opacity:.6; 92 | padding:15px 25px; 93 | -webkit-transition: opacity .4s linear 0s; 94 | -moz-transition: opacity .4s linear 0s; 95 | -o-transition: opacity .4s linear 0s; 96 | transition: opacity .4s linear 0s; 97 | } 98 | 99 | .button:hover { 100 | opacity:1; 101 | } 102 | 103 | .image-round { 104 | border-radius:50%; 105 | } 106 | 107 | .clearfix:before, 108 | .clearfix:after { 109 | content: " "; 110 | display: table; 111 | } 112 | 113 | .clearfix:after { 114 | clear: both; 115 | } 116 | 117 | .l-header { 118 | margin-top:180px; 119 | text-align:center; 120 | } 121 | 122 | .l-navigation { 123 | margin-top:60px; 124 | text-align:center; 125 | } 126 | 127 | .l-footer { 128 | bottom:10px; 129 | position:fixed; 130 | right:10px; 131 | text-align:right; 132 | width:50px; 133 | } 134 | 135 | .l-footer small { 136 | display:block; 137 | font-size:60%; 138 | margin-bottom:5px; 139 | opacity:.5; 140 | text-align:center; 141 | width:100%; 142 | } 143 | 144 | .deckgrid { 145 | margin:100px auto; 146 | padding:10px; 147 | width:1000px; 148 | } 149 | 150 | .deckgrid[deckgrid]::before { 151 | content: '5 .column.size-1-5'; 152 | font-size: 0; 153 | visibility:hidden; 154 | } 155 | 156 | .deckgrid .column { 157 | float:left; 158 | } 159 | 160 | .photo { 161 | background:#fff url(images/spinner.gif) center 30px no-repeat; 162 | border:1px solid rgba(0, 0, 0, .15); 163 | border-radius:3px; 164 | margin:0 10px 10px 0; 165 | position:relative; 166 | } 167 | 168 | .photo .photo-index { 169 | background:rgba(0, 0, 0, .9); 170 | color:#fff; 171 | position:absolute; 172 | height:100%; 173 | text-align:center; 174 | width:100%; 175 | z-index:99; 176 | } 177 | 178 | .photo .photo-index p:first-child { 179 | margin-top:10px; 180 | } 181 | 182 | .photo .photo-wrapper { 183 | min-height:60px; 184 | } 185 | 186 | .photo .photo-description { 187 | padding:15px; 188 | } 189 | 190 | .deckgrid .column.size-1-5 { 191 | width:200px; 192 | } 193 | 194 | .deckgrid .column.size-1-4 { 195 | width:200px; 196 | } 197 | 198 | .deckgrid .column.size-1-3 { 199 | width:250px; 200 | } 201 | 202 | .deckgrid .column.size-1-2 { 203 | width:250px; 204 | } 205 | 206 | .deckgrid .column.size-1-1 { 207 | width:280px; 208 | } 209 | 210 | @media screen and (max-width: 1000px) { 211 | .deckgrid { 212 | width:800px; 213 | } 214 | 215 | .deckgrid[deckgrid]::before { 216 | content: '4 .column.size-1-4'; 217 | } 218 | } 219 | 220 | @media screen and (max-width: 840px) { 221 | .deckgrid { 222 | width:760px; 223 | } 224 | 225 | .deckgrid[deckgrid]::before { 226 | content: '3 .column.size-1-3'; 227 | } 228 | } 229 | 230 | 231 | @media screen and (min-width: 481px) and (max-width: 768px) { 232 | .deckgrid { 233 | margin:100px auto; 234 | width:500px; 235 | } 236 | 237 | .deckgrid[deckgrid]::before { 238 | content: '2 .column.size-1-2'; 239 | } 240 | } 241 | 242 | @media only screen and (max-device-width : 320px), 243 | only screen and (max-width : 480px) { 244 | 245 | .l-header { 246 | font-size:80%; 247 | margin-top:145px; 248 | padding:5px; 249 | text-align:center; 250 | } 251 | 252 | .deckgrid { 253 | width:280px; 254 | } 255 | 256 | .deckgrid[deckgrid]::before { 257 | content: '1 .column.size-1-1'; 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /deepdream/styles/vendor/hint.css: -------------------------------------------------------------------------------- 1 | /*! Hint.css - v1.3.0 - 2013-08-05 2 | * http://kushagragour.in/lab/hint/ 3 | * Copyright (c) 2013 Kushagra Gour; Licensed MIT */ 4 | 5 | .hint,[data-hint]{position:relative;display:inline-block}.hint:before,.hint:after,[data-hint]:before,[data-hint]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease}.hint:hover:before,.hint:hover:after,.hint:focus:before,.hint:focus:after,[data-hint]:hover:before,[data-hint]:hover:after,[data-hint]:focus:before,[data-hint]:focus:after{visibility:visible;opacity:1}.hint:before,[data-hint]:before{content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.hint:after,[data-hint]:after{content:attr(data-hint);background:#383838;color:#fff;text-shadow:0 -1px 0 #000;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;box-shadow:4px 4px 8px rgba(0,0,0,.3)}.hint--top:before{border-top-color:#383838}.hint--bottom:before{border-bottom-color:#383838}.hint--left:before{border-left-color:#383838}.hint--right:before{border-right-color:#383838}.hint--top:before{margin-bottom:-12px}.hint--top:after{margin-left:-18px}.hint--top:before,.hint--top:after{bottom:100%;left:50%}.hint--top:hover:after,.hint--top:hover:before,.hint--top:focus:after,.hint--top:focus:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--bottom:before{margin-top:-12px}.hint--bottom:after{margin-left:-18px}.hint--bottom:before,.hint--bottom:after{top:100%;left:50%}.hint--bottom:hover:after,.hint--bottom:hover:before,.hint--bottom:focus:after,.hint--bottom:focus:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--right:before{margin-left:-12px;margin-bottom:-6px}.hint--right:after{margin-bottom:-14px}.hint--right:before,.hint--right:after{left:100%;bottom:50%}.hint--right:hover:after,.hint--right:hover:before,.hint--right:focus:after,.hint--right:focus:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--left:before{margin-right:-12px;margin-bottom:-6px}.hint--left:after{margin-bottom:-14px}.hint--left:before,.hint--left:after{right:100%;bottom:50%}.hint--left:hover:after,.hint--left:hover:before,.hint--left:focus:after,.hint--left:focus:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0 #592726}.hint--error.hint--top:before{border-top-color:#b34e4d}.hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.hint--error.hint--left:before{border-left-color:#b34e4d}.hint--error.hint--right:before{border-right-color:#b34e4d}.hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0 #6c5328}.hint--warning.hint--top:before{border-top-color:#c09854}.hint--warning.hint--bottom:before{border-bottom-color:#c09854}.hint--warning.hint--left:before{border-left-color:#c09854}.hint--warning.hint--right:before{border-right-color:#c09854}.hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0 #193b4d}.hint--info.hint--top:before{border-top-color:#3986ac}.hint--info.hint--bottom:before{border-bottom-color:#3986ac}.hint--info.hint--left:before{border-left-color:#3986ac}.hint--info.hint--right:before{border-right-color:#3986ac}.hint--success:after{background-color:#458746;text-shadow:0 -1px 0 #1a321a}.hint--success.hint--top:before{border-top-color:#458746}.hint--success.hint--bottom:before{border-bottom-color:#458746}.hint--success.hint--left:before{border-left-color:#458746}.hint--success.hint--right:before{border-right-color:#458746}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:after,.hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--bottom:after,.hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--left:after,.hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--always.hint--right:after,.hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--rounded:after{border-radius:4px}.hint--bounce:before,.hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(0.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(0.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(0.71,1.7,.77,1.24)} -------------------------------------------------------------------------------- /deepdream/templates/deckgrid-card.html: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /deepdream/templates/home.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | -------------------------------------------------------------------------------- /deepdream_vision_ai_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream_vision_ai_screenshot.png -------------------------------------------------------------------------------- /deepdream_vision_ai_screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream_vision_ai_screenshot2.png -------------------------------------------------------------------------------- /deepdream_vision_ai_screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VISIONAI/clouddream/f8c27874a84ffc6622db8837f1babfd6c2e2ff87/deepdream_vision_ai_screenshot3.png -------------------------------------------------------------------------------- /enter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #A simple docker script to enter into the container with caffe and other shell scripts 3 | 4 | if [ "`docker ps | grep deepdream-compute`" = "" ]; then 5 | echo "Making volume" 6 | docker run -t -i --rm --name deepdream-enter -v `pwd`/deepdream:/opt/deepdream visionai/clouddream /bin/bash 7 | else 8 | echo "Steaming volume from deepdream-compute" 9 | docker run -t -i --rm --name deepdream-enter --volumes-from=deepdream-compute visionai/clouddream /bin/bash 10 | fi 11 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Start the docker container which will keep looking for images inside 4 | # the inputs/ directory and spew out results into outputs/ 5 | 6 | PORT=80 7 | docker run --name deepdream-files -v `pwd`/deepdream:/usr/share/nginx/html:ro -d -p ${PORT}:80 nginx 8 | docker run --name deepdream-compute -v `pwd`/deepdream:/opt/deepdream -d visionai/clouddream /bin/bash -c "cd /opt/deepdream && ./process_images.sh 2>&1 > log.html" 9 | docker run --name deepdream-json --volumes-from deepdream-compute -d ubuntu:14.04 /bin/bash -c "cd /opt/deepdream && ./make_json.sh" 10 | 11 | -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Start the docker container which will keep looking for images inside 4 | # the inputs/ directory and spew out results into outputs/ 5 | 6 | docker stop deepdream-files deepdream-compute deepdream-json deepdream-enter 7 | docker rm deepdream-files deepdream-compute deepdream-json deepdream-enter 8 | -------------------------------------------------------------------------------- /youtube.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Script to Download a Youtube movie, extract frames, process them 4 | # with deepdream, and generate a resulting movie. 5 | # 6 | # Usage: 7 | # ./youtube.sh https://www.youtube.com/watch?v=XXXXXXXX 8 | 9 | if [ "$#" -ne 1 ]; then 10 | #Charlie bit my Finger movie is the default 11 | URL=https://www.youtube.com/watch?v=DDZQAJuB3rI 12 | else 13 | URL=$1 14 | fi 15 | 16 | echo "URL is" $URL 17 | 18 | docker stop deepdream-json deepdream-compute deepdream-files 2> /dev/null 19 | docker rm deepdream-json deepdream-compute deepdream-files 2> /dev/null 20 | mkdir /tmp/images 2>/dev/null 21 | rm /tmp/images/* 2> /dev/null 22 | rm deepdream/inputs/* 2>/dev/null 23 | rm deepdream/outputs/* 2>/dev/null 24 | rm /tmp/video.mp4 2>/dev/null 25 | 26 | docker run -it --rm -v /tmp:/tmp jbergknoff/youtube-dl -o /tmp/video.mp4 $URL 27 | docker run -it --rm -v /tmp:/tmp aquarius212/ffmpeg /bin/bash -c "ffmpeg -i /tmp/video.mp4 -r 1 -t 100 -f image2 /tmp/images/image-%05d.jpg" 28 | cp /tmp/images/image*jpg deepdream/inputs/ 29 | 30 | PORT=8000 31 | docker run --name deepdream-files -v `pwd`/deepdream:/usr/share/nginx/html:ro -d -p ${PORT}:80 nginx 32 | docker run -d --name deepdream-json -v `pwd`/deepdream:/opt/deepdream ubuntu:14.04 /bin/bash -c "cd /opt/deepdream && ./make_json.sh" 33 | docker run -it --rm --name deepdream-compute -v `pwd`/deepdream:/opt/deepdream visionai/clouddream /bin/bash -c "cd /opt/deepdream && ./process_images_once.sh 2>&1 > log.html" 34 | 35 | 36 | cp -R deepdream/outputs /tmp/ 37 | rm /tmp/out.mp4 2> /dev/null 38 | docker run -it --rm -v /tmp:/tmp aquarius212/ffmpeg /bin/bash -c "ffmpeg -f image2 -r 1 -i /tmp/outputs/image-%05d.jpg -b 600k -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" /tmp/out.mp4" 39 | cp /tmp/out.mp4 deepdream/ 40 | --------------------------------------------------------------------------------