Skip to content

Commit

Permalink
counting: serializer: If the classifier can't be deserialized for som…
Browse files Browse the repository at this point in the history
…e reason, just ignore the error.

Closes #793
  • Loading branch information
stuarteberg committed Jun 20, 2014
1 parent 2de0c0e commit 04298d7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions ilastik/applets/base/appletSerializer.py
Expand Up @@ -543,16 +543,20 @@ def _deserialize(self, classifierGroup, slot):
with h5py.File(cachePath, 'w') as cacheFile:
cacheFile.copy(classifierGroup, self.name)

forests = []
for name, forestGroup in sorted(classifierGroup.items()):
targetname = '{0}/{1}'.format(self.name, name)
#forests.append(vigra.learning.RandomForest(cachePath, targetname))
from ilastik.applets.counting.countingsvr import SVR
forests.append(SVR.load(cachePath, targetname))


os.remove(cachePath)
os.rmdir(tmpDir)
try:
forests = []
for name, forestGroup in sorted(classifierGroup.items()):
targetname = '{0}/{1}'.format(self.name, name)
#forests.append(vigra.learning.RandomForest(cachePath, targetname))
from ilastik.applets.counting.countingsvr import SVR
forests.append(SVR.load(cachePath, targetname))
except:
warnings.warn( "Wasn't able to deserialize the saved classifier. "
"It will need to be retrainied" )
return
finally:
os.remove(cachePath)
os.rmdir(tmpDir)

# Now force the classifier into our classifier cache. The
# downstream operators (e.g. the prediction operator) can
Expand Down

0 comments on commit 04298d7

Please sign in to comment.