Advertisement
Guest User

AssertionError Lucid

a guest
Feb 20th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. 512 nan
  2. ---------------------------------------------------------------------------
  3. AssertionError Traceback (most recent call last)
  4. <ipython-input-3-c3439b8b3db6> in <module>
  5. 2
  6. 3 obj = objectives.channel("mixed4a_pre_relu", 300) + objectives.channel("mixed4a_pre_relu", 400)
  7. ----> 4 _ = render.render_vis(model, obj)
  8.  
  9. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/optvis/render.py in render_vis(model, objective_f, param_f, optimizer, transforms, thresholds, print_objectives, verbose, relu_gradient_override, use_fixed_seed)
  10. 108 print(i, loss_)
  11. 109 print_objective_func(sess)
  12. --> 110 show(np.hstack(vis))
  13. 111 except KeyboardInterrupt:
  14. 112 log.warning("Interrupted optimization at step {:d}.".format(i+1))
  15.  
  16. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/showing.py in show(thing, domain, **kwargs)
  17. 164 elif rank in (2, 3):
  18. 165 log.debug("Show is assuming rank 2 or 3 tensor to be an image.")
  19. --> 166 image(thing, domain=domain, **kwargs)
  20. 167 else:
  21. 168 log.warning("Show only supports numpy arrays of rank 2-4. Using repr().")
  22.  
  23. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/showing.py in image(array, domain, w, format, **kwargs)
  24. 79
  25. 80 _display_html(
  26. ---> 81 _image_html(array, w=w, domain=domain, fmt=format)
  27. 82 )
  28. 83
  29.  
  30. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/showing.py in _image_html(array, w, domain, fmt)
  31. 61
  32. 62 def _image_html(array, w=None, domain=None, fmt='png'):
  33. ---> 63 url = _image_url(array, domain=domain, fmt=fmt)
  34. 64 style = "image-rendering: pixelated;"
  35. 65 if w is not None:
  36.  
  37. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/showing.py in _image_url(array, fmt, mode, quality, domain)
  38. 53 raise ValueError(message, mode, supported_modes)
  39. 54
  40. ---> 55 image_data = serialize_array(array, fmt=fmt, quality=quality, domain=domain)
  41. 56 base64_byte_string = base64.b64encode(image_data).decode('ascii')
  42. 57 return "data:image/" + fmt.upper() + ";base64," + base64_byte_string
  43.  
  44. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/serialize_array.py in serialize_array(array, domain, fmt, quality)
  45. 116 image data as BytesIO buffer
  46. 117 """
  47. --> 118 normalized = _normalize_array(array, domain=domain)
  48. 119 return _serialize_normalized_array(normalized, fmt=fmt, quality=quality)
  49. 120
  50.  
  51. ~/conda/envs/tf114/lib/python3.6/site-packages/lucid/misc/io/serialize_array.py in _normalize_array(array, domain)
  52. 49 assert len(array.shape) <= 3
  53. 50 assert np.issubdtype(array.dtype, np.number)
  54. ---> 51 assert not np.isnan(array).any()
  55. 52
  56. 53 low, high = np.min(array), np.max(array)
  57.  
  58. AssertionError:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement