How to use the deepforest.tfrecords.create_dataset function in deepforest

To help you get started, we’ve selected a few deepforest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github weecology / DeepForest / tests / test_tfrecords.py View on Github external
def test_create_dataset(test_create_tfrecords):
    dataset = tfrecords.create_dataset(test_create_tfrecords)
github weecology / DeepForest / deepforest / retinanet_train.py View on Github external
# optionally load config parameters
    if args.config:
        args.config = read_config_file(args.config)

    #data input
    if input_type == "fit_generator":
        # create the generators
        train_generator, validation_generator = create_generators(args, backbone.preprocess_image)
        
        #placeholder target tensor for creating models
        targets = None
        
    elif input_type == "tfrecord":
        #Create tensorflow iterators
        iterator = tfrecords.create_dataset(list_of_tfrecords, args.batch_size)
        next_element = iterator.get_next()
        
        #Split into inputs and targets 
        inputs = next_element[0]
        targets = [next_element[1], next_element[2]]
        
        validation_generator = None   
            
    else:
        raise ValueError("{} input type is invalid. Only 'tfrecord' or 'for_generator' input types are accepted for model training".format(input_type))
                
    # create the model
    if args.snapshot is not None:
        print('Loading model, this may take a second...')
        model            = models.load_model(args.snapshot, backbone_name=args.backbone)
        training_model   = model