Exemplo n.º 1
0
def getSamplingResolution(inputs, sampling_rate, proc_per_cpu=8):
    bounds = runInParallel([(s['filename'], ) for s in inputs], getBounds)

    maxx = np.max([b[1][0] - b[0][0] for b in bounds])
    maxy = np.max([b[1][1] - b[0][1] for b in bounds])
    max_dim = np.max([maxx, maxy])
    sampling_resolution = max_dim / sampling_rate
    _logger.debug("sampling_resolution=%s", sampling_resolution)
    return sampling_resolution
Exemplo n.º 2
0
def runFftDescriptorOnFilesParallel(inputs,
                                    sampling_resolution=1,
                                    common_patch_size=1,
                                    proc_per_cpu=4):
    input_params = [(input['filename'], i, i == 0, sampling_resolution,
                     common_patch_size)
                    for input, i in zip(inputs, range(len(inputs)))]
    results = runInParallel(input_params, fftDescriptor)
    return list(zip(inputs, results))
Exemplo n.º 3
0
 def analyzeDescriptors(self):
     sample = pickle.load(
         open(os.path.join(self.output, DESCRIPTOR_PICKLE), 'rb'))
     sorted_subsample = sorted(sample[0:self.specimen_count],
                               key=lambda spec: int(spec['age']))
     results = runInParallel(
         [self.descriptorInput(specimen) for specimen in sorted_subsample],
         computeDescriptor,
         serial=False)
     pickle.dump(results,
                 open(os.path.join(self.output, DESCRIPTOR_PICKLE), 'wb'))
Exemplo n.º 4
0
    def computeDescriptors(self):
        sample = self.getData()
        sorted_subsample = sorted(sample[0:self.params.upper_bound],
                                  key=lambda spec: int(spec['age']))

        results = runInParallel([{
            'specimen': specimen,
            'specimen_no': specimen_no,
            'specimen_total': len(sorted_subsample),
            **self._getParamDict()
        } for specimen_no, specimen in enumerate(sorted_subsample)],
                                computeCurvature,
                                serial=False)
        self.persistData(results)
Exemplo n.º 5
0
def getCommonSamplePatchSize(inputs, sampling_resolution, proc_per_cpu=8):
    patches = runInParallel([(s['filename'], sampling_resolution)
                             for s in inputs], getBounds)
    common_patch_size = np.min([patch[0] for patch in patches])
    _logger.debug("common_patch_size=%s", common_patch_size)
    return common_patch_size