deepdream detail reinjection detail reinjection dream upscale octave dream upscale dream octave octave figure the deepdream processsuccessive scales of spatial processing (octavesand det ail reinjection upon upscaling for each successive scalefrom the smallest to the largestyou run gradient ascent to maximize the loss you previously definedat that scale after each gradient ascent runyou upscale the resulting image by to avoid losing lot of image detail after each successive scale-up (resulting in increasingly blurry or pixelated images)you can use simple trickafter each scaleupyou'll reinject the lost details back into the imagewhich is possible because you know what the original image should look like at the larger scale given small image size and larger image size lyou can compute the difference between the original image resized to size and the original resized to size --this difference quantifies the details lost when going from to listing running gradient ascent over different successive scales playing with these hyperparameters will let you achieve new effects import numpy as np step num_octave octave_scale iterations gradient ascent step size number of scales at which to run gradient ascent size ratio between scales number of ascent steps to run at each scale if the loss grows larger than you'll interrupt the gradient-ascent process to avoid ugly artifacts max_loss base_image_path fill this with the path to the image you want to use img preprocess_image(base_image_pathlicensed to loads the base image into numpy array (function is defined in listing