Broken Code in Chapter 9
jemzipx opened this issue · 1 comments
Masked R-CNN notebooks Instance_Segmentation.ipynb
and predicting_multiple_instances_of_multiple_classes.ipynb
won't run. They give error at following lines:
_annots = stems(annots)
trn_items, val_items = train_test_split(_annots, random_state=2)
RecursionError Traceback (most recent call last)
in ()
7 annots.append(ann)
8 from sklearn.model_selection import train_test_split
----> 9 _annots = stems(annots)
10 trn_items, val_items = train_test_split(_annots, random_state=2)7 frames
... last 1 frames repeated, from the frame below ...
/usr/lib/python3.7/glob.py in _iglob(pathname, recursive, dironly)
69 else:
70 glob_in_dir = _glob0
---> 71 for dirname in dirs:
72 for name in glob_in_dir(dirname, basename, dironly):
73 yield os.path.join(dirname, name)RecursionError: maximum recursion depth exceeded while calling a Python object
I tried to increase recursion depth by adding the following lines:
import sys
sys.setrecursionlimit(10000000)
But it leads to another error:
--
ValueError Traceback (most recent call last)
/tmp/ipykernel_2241122/3562555350.py in
1 from sklearn.model_selection import train_test_split
2 _annots = stems(annots)
----> 3 trn_items, val_items = train_test_split(_annots, random_state=2)~/miniconda3/envs/c2-vision/lib/python3.9/site-packages/sklearn/model_selection/_split.py in train_test_split(test_size, train_size, random_state, shuffle, stratify, *arrays)
2420
2421 n_samples = _num_samples(arrays[0])
-> 2422 n_train, n_test = _validate_shuffle_split(
2423 n_samples, test_size, train_size, default_test_size=0.25
2424 )~/miniconda3/envs/c2-vision/lib/python3.9/site-packages/sklearn/model_selection/_split.py in _validate_shuffle_split(n_samples, test_size, train_size, default_test_size)
2096
2097 if n_train == 0:
-> 2098 raise ValueError(
2099 "With n_samples={}, test_size={} and train_size={}, the "
2100 "resulting train set will be empty. Adjust any of the "ValueError: With n_samples=0, test_size=0.25 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.
Looks like a bug withing torch_snippets
.
UPDATE: I ran into same error in crowd_counting.ipynb
in Chapter 10
Thank you for the feedback. Issue is testing and resolved in the latest version of torch-snippets