anopara / patch-based-texture-synthesis

Based on "Image Quilting for Texture Synthesis and Transfer" and "Real-Time Texture Synthesis by Patch-Based Sampling" papers
MIT License
206 stars 12 forks source link

There is a random crash: ValueError: zero-size array to reduction operation maximum which has no identity #2

Open whiteeat opened 5 years ago

whiteeat commented 5 years ago

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

Vince-Lau commented 5 years ago

the error often occur, but I don't know how to fix, please help