예제 #1
0
import glob

from PIL import Image

from segmenter import Segmenter

image_paths = glob.glob("input/*.png")  # get all images in the input folder

segmenter = Segmenter()  # create an instance of the classifier
predictions = segmenter.run(
    image_paths)  # run the classifier to get predictions

segmenter.save_predictions(predictions,
                           image_paths)  # save the results to output folder

Image.fromarray(
    predictions[0]).show()  # show a single prediction (the first image)
예제 #2
0
generator = LinkGen()
generator.run(categories)
downloader = Downloader(categories, config.BATCH_SIZE)
segmenter = Segmenter()
remover = Remover()
logger = Logger()
processed_video_count = utils.get_processed_video_count()

while processed_video_count < config.NUMBER_OF_LINKS:
    processed_video_count = utils.get_processed_video_count()
    load = utils.get_checkpoints_flag()

    downloader.run()

    segmenter.run()

    source = config.NEURAL_NETWORK_PATH

    tfrecords_command = 'python2.7 %s/utils/generate_tfrecords_dataset.py' \
                        ' --videos_dir %s --save_dir %s' % (config.NEURAL_NETWORK_PATH, config.PROCESSED_VIDEOS_PATH,
                                                            config.TFRECORDS_PATH)
    print(tfrecords_command + '\n')

    start_time = logger.get_current_timestamp()
    subprocess.run(tfrecords_command, shell=True)
    end_time = logger.get_current_timestamp()
    logger.log_tfrecords_generation_time(start_time, end_time)

    starter = NeuralNetworkStarter(config.LEARNING_RATE, len(categories), load)