예제 #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import datetime

import tensorflow as tf
import numpy as np
import pandas as pd
from scipy.misc import imread

from usal_echo.d00_utils.db_utils import dbReadWriteClassification
from usal_echo.d03_classification import vgg
from usal_echo.d00_utils.log_utils import setup_logging

logger = setup_logging(__name__, __name__)

# os.environ["CUDA_VISIBLE_DEVICES"] = "3"

view_classes = [
    "plax_far",
    "plax_plax",
    "plax_laz",
    "psax_az",
    "psax_mv",
    "psax_pap",
    "a2c_lvocc_s",
    "a2c_laocc",
    "a2c",
    "a3c_lvocc_s",
    "a3c_laocc",
예제 #2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import boto3
import os
from usal_echo.d00_utils.log_utils import setup_logging

logger = setup_logging(__name__, "d00_utils.download_s3_objects")


def get_matching_s3_objects(bucket, prefix="", suffix=""):
    """Generate objects in an S3 bucket.

    :param bucket: Name of the S3 bucket.
    :param prefix: Only fetch objects whose key starts with
        this prefix (optional).
    :param suffix: Only fetch objects whose keys end with
        this suffix (optional).
        
    ** code from https://alexwlchan.net/2018/01/listing-s3-keys-redux/

    """
    s3 = boto3.client("s3")
    kwargs = {"Bucket": bucket}

    # If the prefix is a single string (not a tuple of strings), we can
    # do the filtering directly in the S3 API.
    if isinstance(prefix, str):
        kwargs["Prefix"] = prefix

    while True: