Python loader.Loader() Examples

The following are 3 code examples of loader.Loader(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module loader , or try the search function .
Example #1
Source File: label.py    From chexpert-labeler with MIT License 6 votes vote down vote up
def label(args):
    """Label the provided report(s)."""

    loader = Loader(args.reports_path, args.extract_impression)

    extractor = Extractor(args.mention_phrases_dir,
                          args.unmention_phrases_dir,
                          verbose=args.verbose)
    classifier = Classifier(args.pre_negation_uncertainty_path,
                            args.negation_path,
                            args.post_negation_uncertainty_path,
                            verbose=args.verbose)
    aggregator = Aggregator(CATEGORIES,
                            verbose=args.verbose)

    # Load reports in place.
    loader.load()
    # Extract observation mentions in place.
    extractor.extract(loader.collection)
    # Classify mentions in place.
    classifier.classify(loader.collection)
    # Aggregate mentions to obtain one set of labels for each report.
    labels = aggregator.aggregate(loader.collection)

    write(loader.reports, labels, args.output_path, args.verbose) 
Example #2
Source File: sprite.py    From visual-analogy-tensorflow with MIT License 5 votes vote down vote up
def __init__(self, sess, image_size=48, num_hid=512,
               model_type="dis+cls", batch_size=25, dataset="shape"):
    """Initialize the parameters for an Deep Visual Analogy network.

    Args:
      image_size: int, The size of width and height of input image
      model_type: string, The type of increment function ["add", "deep"]
      batch_size: int, The size of a batch [25]
      dataset: str, The name of dataset ["shape", ""]
    """
    self.sess = sess

    self.image_size = image_size
    self.model_type = model_type
    self.batch_size = batch_size
    self.dataset = dataset
    self.num_hid = num_hid
    #self.loader = Loader(self.dataset, self.batch_size)

    self.cards = [2, 4, 3, 6, 2, 2, 2]
    num_categorical = 0
    for card in self.cards:
        num_categorical = num_categorical + card
    self.cards[6] = 3;
    num_categorical = num_categorical + 1
    self.num_categorical = num_categorical

    self.id_idxes = range(0, self.num_categorical - 1)
    self.pose_idxes = range(self.num_categorical, self.num_hid)

    # parameters used to save a checkpoint
    self._attrs = ['max_iter', 'batch_size', 'alpha', 'learning_rate']

    self.build_model() 
Example #3
Source File: shape.py    From visual-analogy-tensorflow with MIT License 5 votes vote down vote up
def __init__(self, sess, image_size=48, model_type="deep",
               batch_size=25, dataset="shape"):
    """Initialize the parameters for an Deep Visual Analogy network.

    Args:
      image_size: int, The size of width and height of input image
      model_type: string, The type of increment function ["add", "deep"]
      batch_size: int, The size of a batch [25]
      dataset: str, The name of dataset ["shape", ""]
    """
    self.sess = sess

    self.image_size = image_size
    self.model_type = model_type
    self.batch_size = batch_size
    self.dataset = dataset
    self.loader = Loader(self.dataset, self.batch_size)

    self.sample_dir = "samples"
    if not os.path.exists(self.sample_dir):
      os.makedirs(self.sample_dir)

    # parameters used to save a checkpoint
    self._attrs = ['batch_size', 'model_type', 'image_size']
    self.options = ['rotate', 'scale', 'xpos', 'ypos']

    self.build_model()