Spaces:
Runtime error
Runtime error
Commit
·
4b6fc2d
1
Parent(s):
523c29d
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,10 +17,10 @@ extra_args = {}
|
|
| 17 |
model_type = models.torchvision.retinanet
|
| 18 |
backbone = model_type.backbones.resnet50_fpn
|
| 19 |
# Instantiate the model
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
import models
|
| 23 |
-
model = model.pth
|
| 24 |
|
| 25 |
|
| 26 |
# Transforms
|
|
@@ -35,8 +35,11 @@ valid_ds = Dataset(valid_records, valid_tfms)
|
|
| 35 |
train_dl = model_type.train_dl(train_ds, batch_size=8, num_workers=4, shuffle=True)
|
| 36 |
valid_dl = model_type.valid_dl(valid_ds, batch_size=8, num_workers=4, shuffle=False)
|
| 37 |
metrics = [COCOMetric(metric_type=COCOMetricType.bbox)]
|
|
|
|
| 38 |
learn = model_type.fastai.learner(dls=[train_dl, valid_dl], model=model, metrics=metrics)
|
|
|
|
| 39 |
learn = learn.load('model')
|
|
|
|
| 40 |
import os
|
| 41 |
for root, dirs, files in os.walk(r'sample_images/'):
|
| 42 |
for filename in files:
|
|
|
|
| 17 |
model_type = models.torchvision.retinanet
|
| 18 |
backbone = model_type.backbones.resnet50_fpn
|
| 19 |
# Instantiate the model
|
| 20 |
+
|
| 21 |
+
#model = model_type.model(backbone=backbone(pretrained=True), num_classes=len(parser.class_map), **extra_args)
|
| 22 |
|
| 23 |
import models
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
# Transforms
|
|
|
|
| 35 |
train_dl = model_type.train_dl(train_ds, batch_size=8, num_workers=4, shuffle=True)
|
| 36 |
valid_dl = model_type.valid_dl(valid_ds, batch_size=8, num_workers=4, shuffle=False)
|
| 37 |
metrics = [COCOMetric(metric_type=COCOMetricType.bbox)]
|
| 38 |
+
|
| 39 |
learn = model_type.fastai.learner(dls=[train_dl, valid_dl], model=model, metrics=metrics)
|
| 40 |
+
|
| 41 |
learn = learn.load('model')
|
| 42 |
+
|
| 43 |
import os
|
| 44 |
for root, dirs, files in os.walk(r'sample_images/'):
|
| 45 |
for filename in files:
|