Comments (2)
Hi Johannes @jo-mueller ,
can you paste the error message here and also let me know which function you called (example code welcome)? It's otherwise hard to guess what went wrong.
Thanks!
Robert
from apoc.
Hi @haesleinhuepf ,
the code is from the train_on_folder_of_images notebook, particularly this cell:
# setup classifer and where it should be saved
cl_filename = "test_object_segmenter_from_folders.cl"
apoc.erase_classifier(cl_filename)
segmenter = apoc.PixelClassifier(opencl_filename=cl_filename)
# setup feature set used for training
features = apoc.PredefinedFeatureSet.object_size_1_to_5_px.value
# train classifier on folders
apoc.train_classifier_from_image_folders(
segmenter,
features,
image = image_folder,
ground_truth = masks_folder)
Full traceback:
FileNotFoundError Traceback (most recent call last)
Input In [5], in <cell line: 10>()
7 features = apoc.PredefinedFeatureSet.object_size_1_to_5_px.value
9 # train classifier on folders
---> 10 apoc.train_classifier_from_image_folders(
11 segmenter,
12 features,
13 image = image_folder,
14 ground_truth = masks_folder)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\apoc\_utils.py:216, in train_classifier_from_image_folders(classifier, features, **kwargs)
211 kwargs_to_pass = {
212 'features': features,
213 'continue_training': continue_training
214 }
215 for key, value in kwargs.items():
--> 216 kwargs_to_pass[key] = imread(kwargs[key] + filename)
218 # run training
219 classifier.train(**kwargs_to_pass)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\skimage\io\_io.py:53, in imread(fname, as_gray, plugin, **plugin_args)
50 plugin = 'tifffile'
52 with file_or_url_context(fname) as fname:
---> 53 img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
55 if not hasattr(img, 'ndim'):
56 return img
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\skimage\io\manage_plugins.py:207, in call_plugin(kind, *args, **kwargs)
203 except IndexError:
204 raise RuntimeError('Could not find the plugin "%s" for %s.' %
205 (plugin, kind))
--> 207 return func(*args, **kwargs)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\skimage\io\_plugins\tifffile_plugin.py:30, in imread(fname, **kwargs)
27 if 'img_num' in kwargs:
28 kwargs['key'] = kwargs.pop('img_num')
---> 30 return tifffile_imread(fname, **kwargs)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\tifffile\tifffile.py:891, in imread(files, aszarr, **kwargs)
888 files = files[0]
890 if isinstance(files, (str, os.PathLike)) or hasattr(files, 'seek'):
--> 891 with TiffFile(files, **kwargs_file) as tif:
892 if aszarr:
893 return tif.aszarr(**kwargs)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\tifffile\tifffile.py:3131, in TiffFile.__init__(self, arg, mode, name, offset, size, _multifile, _useframes, _parent, **kwargs)
3128 if mode not in (None, 'rb', 'r+b'):
3129 raise ValueError(f'invalid mode {mode!r}')
-> 3131 fh = FileHandle(arg, mode=mode, name=name, offset=offset, size=size)
3132 self._fh = fh
3133 self._multifile = bool(_multifile)
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\tifffile\tifffile.py:10447, in FileHandle.__init__(self, file, mode, name, offset, size)
10445 self.is_file = None
10446 self._lock = NullContext()
> 10447 self.open()
File ~\Anaconda3\envs\pdo_ana_env\lib\site-packages\tifffile\tifffile.py:10460, in FileHandle.open(self)
10458 self._file = os.path.realpath(self._file)
10459 self._dir, self._name = os.path.split(self._file)
> 10460 self._fh = open(self._file, self._mode)
10461 self._close = True
10462 if self._offset is None:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\saja957d\\Desktop\\DD282\\imagesimage_1_1.tif'
A simple fix to this error is to simply pass masks_folder + '\\'
and image_folder + '\\'
to the train_classifier_from_image_folders
to make it work. It would be nice though, to just take care of this stuff under the hood.
from apoc.
Related Issues (18)
- 'clf.train' error = boolean index did not match indexed array along dimension 0 HOT 5
- Question about the ObjectClassifer._select_features() docstring HOT 2
- pytest-fy tests HOT 3
- Object classifier: Fix return type / type of internally handled measurements
- Remove dual feature specification in TableRowClassifier
- Explicitly compare given feature list and specified feature list in TableRowClassifier HOT 1
- Remove 'return_numpy' from TableRowClassifier API HOT 1
- Feature request: Print classifier info HOT 8
- Feature request: Classifier uncertainty HOT 14
- if there are subfolder in the image folder, train on folders failed
- missing documentation on python interface for pixel classification HOT 1
- make ObjectMerger train on folders work
- Documentation? HOT 2
- auto-context
- spearman's correlation matrix
- SimpleITK-based object classifier? HOT 1
- Train / predict from tables HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apoc.