diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6c9af9d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +# see https://github.com/keras-team/keras \ No newline at end of file diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/Untitled.ipynb b/Untitled.ipynb new file mode 100644 index 0000000..d4d5f44 --- /dev/null +++ b/Untitled.ipynb @@ -0,0 +1,49 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import keras\n", + "import yolk \n", + "\n", + "voc_train, voc_valid = yolk.datasets.pascal_voc07()\n", + "yolov3 = yolk.models.yolov3()\n", + "\n", + "yolov3.compile(\n", + " loss=yolk.losses.yolov3Loss\n", + " optimizer='adam', metrics=['coco']\n", + " )\n", + " \n", + "yolov3.fit_generator(\n", + " generator=voc_train,\n", + " validation_data=voc_valid,\n", + " epochs=20\n", + ")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/docker/todo b/docker/todo new file mode 100644 index 0000000..e69de29 diff --git a/docs/todo b/docs/todo new file mode 100644 index 0000000..e69de29 diff --git a/examples/todo b/examples/todo new file mode 100644 index 0000000..e69de29 diff --git a/test/todo b/test/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/applications/todo b/yolk/applications/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/callbacks/todo b/yolk/callbacks/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/datasets/__init__.py b/yolk/datasets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/yolk/datasets/pascal.py b/yolk/datasets/pascal.py new file mode 100644 index 0000000..c2f525e --- /dev/null +++ b/yolk/datasets/pascal.py @@ -0,0 +1,133 @@ + +def create_generators(args, preprocess_image): + """ Create generators for training and validation. + + Args + args : parseargs object containing configuration for generators. + preprocess_image : Function that preprocesses an image for the network. + """ + common_args = { + 'batch_size' : args.batch_size, + 'config' : args.config, + 'image_min_side' : args.image_min_side, + 'image_max_side' : args.image_max_side, + 'preprocess_image' : preprocess_image, + } + + # create random transform generator for augmenting training data + if args.random_transform: + transform_generator = random_transform_generator( + min_rotation=-0.1, + max_rotation=0.1, + min_translation=(-0.1, -0.1), + max_translation=(0.1, 0.1), + min_shear=-0.1, + max_shear=0.1, + min_scaling=(0.9, 0.9), + max_scaling=(1.1, 1.1), + flip_x_chance=0.5, + flip_y_chance=0.5, + ) + visual_effect_generator = random_visual_effect_generator( + contrast_range=(0.9, 1.1), + brightness_range=(-.1, .1), + hue_range=(-0.05, 0.05), + saturation_range=(0.95, 1.05) + ) + else: + transform_generator = random_transform_generator(flip_x_chance=0.5) + visual_effect_generator = None + + if args.dataset_type == 'coco': + # import here to prevent unnecessary dependency on cocoapi + from ..preprocessing.coco import CocoGenerator + + train_generator = CocoGenerator( + args.coco_path, + 'train2017', + transform_generator=transform_generator, + visual_effect_generator=visual_effect_generator, + **common_args + ) + + validation_generator = CocoGenerator( + args.coco_path, + 'val2017', + shuffle_groups=False, + **common_args + ) + elif args.dataset_type == 'pascal': + train_generator = PascalVocGenerator( + args.pascal_path, + 'trainval', + transform_generator=transform_generator, + visual_effect_generator=visual_effect_generator, + **common_args + ) + + validation_generator = PascalVocGenerator( + args.pascal_path, + 'test', + shuffle_groups=False, + **common_args + ) + elif args.dataset_type == 'csv': + train_generator = CSVGenerator( + args.annotations, + args.classes, + transform_generator=transform_generator, + visual_effect_generator=visual_effect_generator, + **common_args + ) + + if args.val_annotations: + validation_generator = CSVGenerator( + args.val_annotations, + args.classes, + shuffle_groups=False, + **common_args + ) + else: + validation_generator = None + elif args.dataset_type == 'oid': + train_generator = OpenImagesGenerator( + args.main_dir, + subset='train', + version=args.version, + labels_filter=args.labels_filter, + annotation_cache_dir=args.annotation_cache_dir, + parent_label=args.parent_label, + transform_generator=transform_generator, + visual_effect_generator=visual_effect_generator, + **common_args + ) + + validation_generator = OpenImagesGenerator( + args.main_dir, + subset='validation', + version=args.version, + labels_filter=args.labels_filter, + annotation_cache_dir=args.annotation_cache_dir, + parent_label=args.parent_label, + shuffle_groups=False, + **common_args + ) + elif args.dataset_type == 'kitti': + train_generator = KittiGenerator( + args.kitti_path, + subset='train', + transform_generator=transform_generator, + visual_effect_generator=visual_effect_generator, + **common_args + ) + + validation_generator = KittiGenerator( + args.kitti_path, + subset='val', + shuffle_groups=False, + **common_args + ) + else: + raise ValueError('Invalid data type received: {}'.format(args.dataset_type)) + + return train_generator, validation_generator \ No newline at end of file diff --git a/yolk/datasets/todo b/yolk/datasets/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/engine/todo b/yolk/engine/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/layers/todo b/yolk/layers/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/models/todo b/yolk/models/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/preprocessing/todo b/yolk/preprocessing/todo new file mode 100644 index 0000000..e69de29 diff --git a/yolk/utils/todo b/yolk/utils/todo new file mode 100644 index 0000000..e69de29