From 57226b64eac5f3a835c0d8c15d26431c951b67e2 Mon Sep 17 00:00:00 2001 From: borhanMorphy Date: Fri, 16 Jul 2021 03:51:08 +0300 Subject: [PATCH] finalized flash_examples/face_detection.py for user api (#508) --- flash_examples/face_detection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flash_examples/face_detection.py b/flash_examples/face_detection.py index 4e6160e949c..638c453cb82 100644 --- a/flash_examples/face_detection.py +++ b/flash_examples/face_detection.py @@ -30,14 +30,18 @@ datamodule = FaceDetectionData.from_fddb( data_folder="data/", train_data=True, + val_data=True, ) # 2. Build the task model = FaceDetector(model="lffd_slim") # 3. Create the trainer and finetune the model -trainer = flash.Trainer(max_epochs=3) -trainer.finetune(model, datamodule=datamodule) +trainer = flash.Trainer(max_epochs=3, + limit_train_batches=0.1, + limit_val_batches=0.1) + +trainer.finetune(model, datamodule=datamodule, strategy="freeze") # 4. Detect faces in a few images! predictions = model.predict([