Skip to content

Scene Segmentation with SynF #509

@amyvanee

Description

@amyvanee

#39 My issue is about adjusting Proglearn so we can do scene segmentation after flattening the images.

Reproducing code example:

def load_images(flatten_imgs):
    if flatten_imgs:
        X = np.array([cv2.imread(imgpath).flatten() for imgpath in imgpaths])
        Y = np.array([cv2.imread(lblpath).flatten() for lblpath in lblpaths])
    else:
        X = np.array([cv2.imread(imgpath) for imgpath in imgpaths])
        Y = np.array([cv2.imread(lblpath) for lblpath in lblpaths])
    return X,Y

flatten_imgs = True
X, Y = load_images(flatten_imgs)

from random_class_functions import Odif_experiment

slot_num = int(5000 / num_points_per_task)
slot_fold = range(slot_num)
shift_fold = range(1, shift_num + 1, 1)

# run the Odif model
n_trees = [tree_num]
iterable = product(n_trees, shift_fold, slot_fold)
df_results = Parallel(n_jobs=-1, verbose=0)(
    delayed(Odif_experiment)(
        X, Y, ntree, shift, slot, num_points_per_task, acorn=12345
    )
    for ntree, shift, slot in iterable
)

Error message

AttributeError                            Traceback (most recent call last)
<ipython-input-8-097c14639e16> in <module>
     10 n_trees = [tree_num]
     11 iterable = product(n_trees, shift_fold, slot_fold)
---> 12 df_results = Parallel(n_jobs=-1, verbose=0)(
     13     delayed(Odif_experiment)(
     14         X, Y, ntree, shift, slot, num_points_per_task, acorn=12345

~\AppData\Local\Programs\Python\Python39\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
   1052 
   1053             with self._backend.retrieval_context():
-> 1054                 self.retrieve()
   1055             # Make sure that we get a last message telling us we are done
   1056             elapsed_time = time.time() - self._start_time

~\AppData\Local\Programs\Python\Python39\lib\site-packages\joblib\parallel.py in retrieve(self)
    931             try:
    932                 if getattr(self._backend, 'supports_timeout', False):
--> 933                     self._output.extend(job.get(timeout=self.timeout))
    934                 else:
    935                     self._output.extend(job.get())

~\AppData\Local\Programs\Python\Python39\lib\site-packages\joblib\_parallel_backends.py in wrap_future_result(future, timeout)
    540         AsyncResults.get from multiprocessing."""
    541         try:
--> 542             return future.result(timeout=timeout)
    543         except CfTimeoutError as e:
    544             raise TimeoutError from e

~\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py in result(self, timeout)
    443                     raise CancelledError()
    444                 elif self._state == FINISHED:
--> 445                     return self.__get_result()
    446                 else:
    447                     raise TimeoutError()

~\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py in __get_result(self)
    388         if self._exception:
    389             try:
--> 390                 raise self._exception
    391             finally:
    392                 # Break a reference cycle with the exception in self._exception

AttributeError: 'bool' object has no attribute 'any'

Version information

  • OS: [e.g. macOS] Windows
  • Python Version [e.g. 3.7.3]: Python 3.7.3
  • Package Version [e.g. 0.0.1]: Proglearn 0.0.5

Metadata

Metadata

Assignees

Labels

nddNeuro Data Design

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions