New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in fast.ai transform.py #87
Comments
Can you check if using
RandomDihedralXY instead of RandomDihedral solves your problem? We have to
fix RandomDihedral.
…On Wed, Jan 10, 2018 at 1:00 PM, Irshad Muhammad ***@***.***> wrote:
transforms_pt = [RandomRotateZoom(9, 0.18, 0.1), RandomLighting(0.05, 0.1), RandomDihedral()]
tfms=tfms_from_model(f_model, sz, aug_tfms=transforms_pt, pad=sz//12)
val_idx = get_cv_idxs(train_len)
data = ImageClassifierData.from_csv(path, 'train-jpg', f'{path}train_v2.csv', bs, tfms, suffix='.jpg', val_idxs=val_idx, test_name='test-jpg')
lr=0.2
lrs=[lr/9, lr/3, lr]
learn = ConvLearner.pretrained(f_model, data, metrics=metrics)
learn.fit(lr, 3, cycle_len=1, cycle_mult=2)
Error:
0%| | 0/506 [00:00<?, ?it/s]
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-28-a0d195fa61d1> in <module>()
11 learn = ConvLearner.pretrained(f_model, data, metrics=metrics)
12
---> 13 learn.fit(lr, 3, cycle_len=1, cycle_mult=2)
~/fastai/courses/dl1/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
211 self.sched = None
212 layer_opt = self.get_layer_opt(lrs, wds)
--> 213 self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
214
215 def warm_up(self, start_lr=1e-5, end_lr=10, wds=None):
~/fastai/courses/dl1/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, **kwargs)
158 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle)
159 fit(model, data, n_epoch, layer_opt.opt, self.crit,
--> 160 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs)
161
162 def get_layer_groups(self): return self.models.get_layer_groups()
~/fastai/courses/dl1/fastai/model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, **kwargs)
84 stepper.reset(True)
85 t = tqdm(iter(data.trn_dl), leave=False, total=len(data.trn_dl))
---> 86 for (*x,y) in t:
87 batch_num += 1
88 for cb in callbacks: cb.on_batch_begin()
~/anaconda3/envs/fastai/lib/python3.6/site-packages/tqdm/_tqdm.py in __iter__(self)
951 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
952
--> 953 for obj in iterable:
954 yield obj
955 # Update and possibly print the progressbar.
~/fastai/courses/dl1/fastai/dataset.py in __next__(self)
241 if self.i>=len(self.dl): raise StopIteration
242 self.i+=1
--> 243 return next(self.it)
244
245 @Property
~/fastai/courses/dl1/fastai/dataloader.py in __iter__(self)
73 def __iter__(self):
74 with ThreadPoolExecutor(max_workers=self.num_workers) as e:
---> 75 for batch in e.map(self.get_batch, iter(self.batch_sampler)):
76 yield get_tensor(batch, self.pin_memory)
77
~/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in result_iterator()
584 # Careful not to keep a reference to the popped future
585 if timeout is None:
--> 586 yield fs.pop().result()
587 else:
588 yield fs.pop().result(end_time - time.time())
~/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in result(self, timeout)
423 raise CancelledError()
424 elif self._state == FINISHED:
--> 425 return self.__get_result()
426
427 self._condition.wait(timeout)
~/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
~/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/thread.py in run(self)
54
55 try:
---> 56 result = self.fn(*self.args, **self.kwargs)
57 except BaseException as exc:
58 self.future.set_exception(exc)
~/fastai/courses/dl1/fastai/dataloader.py in get_batch(self, indices)
66
67 def get_batch(self, indices):
---> 68 res = self.collate_fn([self.dataset[i] for i in indices], self.pad_idx)
69 if not self.transpose: return res
70 res[0] = res[0].T
~/fastai/courses/dl1/fastai/dataloader.py in <listcomp>(.0)
66
67 def get_batch(self, indices):
---> 68 res = self.collate_fn([self.dataset[i] for i in indices], self.pad_idx)
69 if not self.transpose: return res
70 res[0] = res[0].T
~/fastai/courses/dl1/fastai/dataset.py in __getitem__(self, idx)
95 def __getitem__(self, idx):
96 x,y = self.get_x(idx),self.get_y(idx)
---> 97 return self.get(self.transform, x, y)
98
99 def __len__(self): return self.n
~/fastai/courses/dl1/fastai/dataset.py in get(self, tfm, x, y)
100
101 def get(self, tfm, x, y):
--> 102 return (x,y) if tfm is None else tfm(x,y)
103
104 @AbstractMethod
~/fastai/courses/dl1/fastai/transforms.py in __call__(self, im, y)
463 if crop_type == CropType.NO: crop_tfm = NoCropXY(sz, tfm_y)
464 self.tfms = tfms + [crop_tfm, normalizer, channel_dim]
--> 465 def __call__(self, im, y=None): return compose(im, y, self.tfms)
466
467
~/fastai/courses/dl1/fastai/transforms.py in compose(im, y, fns)
444 def compose(im, y, fns):
445 for fn in fns:
--> 446 im, y =fn(im, y)
447 return im if y is None else (im, y)
448
~/fastai/courses/dl1/fastai/transforms.py in __call__(self, x, y)
134 if choice==0: pass
135 elif choice==1: x = rotate_cv(x, rand0(self.deg), self.mode)
--> 136 elif choice==2: x = zoom_cv(x, random.random()*self.zoom)
137 elif choice==3:
138 str_choice = random.randint(0,1)
~/fastai/courses/dl1/fastai/transforms.py in zoom_cv(x, z)
17 def zoom_cv(x,z):
18 if z==0: return x
---> 19 r,c,*_ = im.shape
20 M = cv2.getRotationMatrix2D((c/2,r/2),0,z+1.)
21 return cv2.warpAffine(x,M,(c,r))
NameError: name 'im' is not defined
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#87>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC3CZbeGESdpvGH2wvp9lDJZdGnPjDZFks5tJST7gaJpZM4RZ8Ad>
.
|
@yanneta is this solved? |
It should be solved now.
…On Mon, Jan 22, 2018 at 3:55 PM, Jeremy Howard ***@***.***> wrote:
@yanneta <https://github.com/yanneta> is this solved?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#87 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC3CZfmzdDvTT0n3Hbh7lXufZ9chuw_Gks5tNR_igaJpZM4RZ8Ad>
.
|
borisdayma
pushed a commit
to borisdayma/fastai
that referenced
this issue
Aug 18, 2020
borisdayma
pushed a commit
to borisdayma/fastai
that referenced
this issue
Aug 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: