anopara / patch-based-texture-synthesis Goto Github PK
View Code? Open in Web Editor NEWBased on "Image Quilting for Texture Synthesis and Transfer" and "Real-Time Texture Synthesis by Patch-Based Sampling" papers
License: MIT License
Based on "Image Quilting for Texture Synthesis and Transfer" and "Real-Time Texture Synthesis by Patch-Based Sampling" papers
License: MIT License
More of a comment than a real issue. But would it be possible to include a requirement.txt so that users can jump into using this package with less keystrokes?
Hi,
is there a hard limit to the size of the example image?
Consistently getting Out of memory errors with example images larger than around 300 pixels when testing on google colab
Any help would be appreciated :)
Also getting the following error, not sure if it's the cause of the crash or an effect of it:
`modified output size: (2050, 2050, 3)
number of patches: 34
/content/patch-based-texture-synthesis/patchBasedTextureSynthesis.py:237: RuntimeWarning: invalid value encountered in true_divide
probabilities /= np.sum(probabilities) #normalize so they add up to one
ValueError Traceback (most recent call last)
in ()
6
7 pbts = patchBasedTextureSynthesis(exampleMapPath, outputPath, outputSize, patchSize, overlapSize, in_windowStep = 5, in_mirror_hor = True, in_mirror_vert = True, in_shapshots = True)
----> 8 pbts.resolveAll()
1 frames
/content/patch-based-texture-synthesis/patchBasedTextureSynthesis.py in resolveNext(self)
79 #choose random valid patch
80 probabilities = self.distances2probability(dist, self.PARM_truncation, self.PARM_attenuation)
---> 81 chosenPatchId = np.random.choice(ind, 1, p=probabilities)
82
83 #update canvas
mtrand.pyx in numpy.random.mtrand.RandomState.choice()
ValueError: probabilities contain NaN`
Thanks for sharing the patch based version. I will totally include it in my current workflow.
Below is the full log:
ValueError
8 pbts = patchBasedTextureSynthesis(exampleMapPath, outputPath, outputSize, patchSize, overlapSize, in_windowStep = 5, in_mirror_hor = True, in_mirror_vert = True, in_shapshots = True)
----> 9 pbts.resolveAll()
F:\ZheChen\GitHubCode\patch-based-texture-synthesis\patchBasedTextureSynthesis.py in resolveAll(self)
46 #resolve all unresolved patches
47 for i in range(np.sum(1-self.filledMap).astype(int)):
---> 48 self.resolveNext()
49
50 if not self.snapshots:
F:\ZheChen\GitHubCode\patch-based-texture-synthesis\patchBasedTextureSynthesis.py in resolveNext(self)
75
76 #choose random valid patch
---> 77 probabilities = self.distances2probability(dist, self.PARM_truncation, self.PARM_attenuation)
78 chosenPatchId = np.random.choice(ind, 1, p=probabilities)
79
F:\ZheChen\GitHubCode\patch-based-texture-synthesis\patchBasedTextureSynthesis.py in distances2probability(self, distances, PARM_truncation, PARM_attenuation)
222 def distances2probability(self, distances, PARM_truncation, PARM_attenuation):
223
--> 224 probabilities = 1 - distances / np.max(distances)
225 probabilities *= (probabilities > PARM_truncation)
226 probabilities = pow(probabilities, PARM_attenuation) #attenuate the values
E:\anaconda3\envs\ts\lib\site-packages\numpy\core\fromnumeric.py in amax(a, axis, out, keepdims, initial)
2332 """
2333 return _wrapreduction(a, np.maximum, 'max', axis, None, out, keepdims=keepdims,
-> 2334 initial=initial)
2335
2336
E:\anaconda3\envs\ts\lib\site-packages\numpy\core\fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
81 return reduction(axis=axis, out=out, **passkwargs)
82
---> 83 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
84
85
ValueError: zero-size array to reduction operation maximum which has no identity
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.