Skip to content

Error at around stage 40 #6

Description

@enzyme69

I tested this using my own image but keep on failing:
corgi

Not sure why...

Stage  45 . Generation  1 / 20
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-d878b63d593f> in <module>
      1 #load the example image and set the generator for 100 stages with 20 generations each
      2 gen = GeneticDrawing('corgi.jpg', seed=time.time())
----> 3 out = gen.generate(100, 20)

~/genetic-drawing-master/genetic_drawing.py in generate(self, stages, generations, brushstrokesCount, show_progress_imgs)
     40                 if show_progress_imgs is True:
     41                     #plt.imshow(sampling_mask, cmap='gray')
---> 42                     plt.imshow(self.myDNA.get_cached_image(), cmap='gray')
     43                     plt.show()
     44             self.imgBuffer.append(self.myDNA.get_cached_image())

/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, data, **kwargs)
   2699         filternorm=filternorm, filterrad=filterrad, imlim=imlim,
   2700         resample=resample, url=url, **({"data": data} if data is not
-> 2701         None else {}), **kwargs)
   2702     sci(__ret)
   2703     return __ret

/usr/local/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1803                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1804                         RuntimeWarning, stacklevel=2)
-> 1805             return func(ax, *args, **kwargs)
   1806 
   1807         inner.__doc__ = _add_data_doc(inner.__doc__,

/usr/local/lib/python3.7/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
   5481                               resample=resample, **kwargs)
   5482 
-> 5483         im.set_data(X)
   5484         im.set_alpha(alpha)
   5485         if im.get_clip_path() is None:

/usr/local/lib/python3.7/site-packages/matplotlib/image.py in set_data(self, A)
    640         if (self._A.dtype != np.uint8 and
    641                 not np.can_cast(self._A.dtype, float, "same_kind")):
--> 642             raise TypeError("Image data cannot be converted to float")
    643 
    644         if not (self._A.ndim == 2

TypeError: Image data cannot be converted to float

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions