This commit is contained in:
PatrickBue 2020-02-05 13:13:18 -05:00 коммит произвёл GitHub
Родитель 296ca6415f
Коммит 928008bb0b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 95 добавлений и 65 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -21,6 +21,7 @@ from fastai.vision.data import ImageList, imagenet_stats
from typing import List, Tuple
from tempfile import TemporaryDirectory
from utils_cv.common.data import unzip_url
from utils_cv.common.gpu import db_num_workers
from utils_cv.classification.data import Urls as ic_urls
from utils_cv.detection.data import Urls as od_urls
from utils_cv.detection.bbox import DetectionBbox, AnnotationBbox
@ -278,7 +279,7 @@ def tiny_ic_databunch(tmp_session):
.split_by_rand_pct(valid_pct=0.1, seed=20)
.label_from_folder()
.transform(size=50)
.databunch(bs=16)
.databunch(bs=16, num_workers = db_num_workers())
.normalize(imagenet_stats)
)
@ -350,7 +351,7 @@ def testing_databunch(tmp_session):
.split_by_rand_pct(valid_pct=0.2, seed=20)
.label_from_folder()
.transform(size=300)
.databunch(bs=16)
.databunch(bs=16, num_workers = db_num_workers())
.normalize(imagenet_stats)
)

Просмотреть файл

@ -57,6 +57,31 @@ def test_02_notebook_run(detection_notebooks):
assert d > 0.15
@pytest.mark.notebooks
@pytest.mark.linuxgpu
def test_03_notebook_run(detection_notebooks):
epochs = 5
notebook_path = detection_notebooks["03"]
pm.execute_notebook(
notebook_path,
OUTPUT_NOTEBOOK,
parameters=dict(
PM_VERSION=pm.__version__,
EPOCHS=epochs,
),
kernel_name=KERNEL_NAME,
)
nb_output = sb.read_notebook(OUTPUT_NOTEBOOK)
training_losses = nb_output.scraps["training_losses"].data
assert len(training_losses) == epochs
assert training_losses[-1] < 1.5
assert training_losses[0] > 1.5*training_losses[-1]
assert len(nb_output.scraps["keypoints"].data) == len(
nb_output.scraps["bboxes"].data
)
@pytest.mark.notebooks
@pytest.mark.linuxgpu
def test_12_notebook_run(detection_notebooks):

Просмотреть файл

@ -52,7 +52,8 @@ def test_11_notebook_run(similarity_notebooks, tiny_ic_data_path):
# Speed up testing since otherwise would take ~12 minutes on V100
DATA_PATHS=[tiny_ic_data_path],
REPS=1,
IM_SIZES=[60, 100],
IM_SIZES=[60, 70],
LEARNING_RATES=[1e-3, 1e-4]
),
kernel_name=KERNEL_NAME,
)

Просмотреть файл

@ -118,7 +118,6 @@ def test_train_metrics_recorder(tiny_ic_databunch):
def test_callback(learn):
tmr = TrainMetricsRecorder(learn)
learn.callbacks.append(tmr)
learn.unfreeze()
learn.fit(epochs, lr)
return tmr

Просмотреть файл

@ -6,6 +6,7 @@ from pathlib import Path
from PIL import ImageFont
from fastai.vision import ImageList
from utils_cv.common.gpu import db_num_workers
from utils_cv.common.misc import copy_files, set_random_seed, get_font
@ -17,7 +18,7 @@ def test_set_random_seed(tiny_ic_data_path):
.split_by_rand_pct()
.label_from_folder()
.transform()
.databunch(bs=5)
.databunch(bs=5, num_workers = db_num_workers())
.normalize()
)
first_batch = first_data.one_batch()
@ -28,7 +29,7 @@ def test_set_random_seed(tiny_ic_data_path):
.split_by_rand_pct()
.label_from_folder()
.transform()
.databunch(bs=5)
.databunch(bs=5, num_workers = db_num_workers())
.normalize()
)
second_batch = second_data.one_batch()