Skip to content

Commit

Permalink
Update ocr training
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitroprobachay committed Jan 6, 2025
1 parent 3645625 commit 90f1857
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nomeroff_net/data_loaders/text_image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def generate_cache_x_in_path(self, img_path: str, cache_dirpath: str, newsize: T
if newsize is None:
newsize = (self.img_w, self.img_h)
img = Image.open(img_path).convert('RGB')
img = img.resize(newsize)
if self.with_aug:
from nomeroff_net.tools.augmentations import aug
img = np.array(img)
imgs = aug([img])
img = Image.fromarray(imgs[0])
img = img.resize(newsize)
x = self.transform(img)
torch.save(x, x_path)
return x_path
Expand Down
1 change: 1 addition & 0 deletions nomeroff_net/pipes/number_plate_text_readers/base/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def train(self,
pl.seed_everything(seed)
if self.model is None:
self.create_model()
self.model.train()
checkpoint_callback = ModelCheckpoint(dirpath=log_dir, monitor='val_loss')
lr_monitor = LearningRateMonitor(logging_interval='step')
if self.gpus:
Expand Down

0 comments on commit 90f1857

Please sign in to comment.