예제 #1
0
    def createGeneralGraph(self, numSites, numLabels, energyIsFloat=False):
        """Create a general graph with specified number of sites and labels. 
        If energyIsFloat is set to True, then automatic scaling and rounding
        will be applied to convert all energies to integers when running graph
        cuts. Then the final energy will be converted back to floats after the
        computation."""
        self.tempArray = np.empty(1, dtype=np.intc)
        self.energyTempArray = np.empty(1, dtype=np.longlong)
        _cgco.gcoCreateGeneralGraph(np.intc(numSites), np.intc(numLabels), self.tempArray)

        self.handle = self.tempArray[0]
        self.numSites = np.intc(numSites)
        self.numLabels = np.intc(numLabels)
        self.energyIsFloat = energyIsFloat
예제 #2
0
    def createGeneralGraph(self, numSites, numLabels, energyIsFloat=False):
        """Create a general graph with specified number of sites and labels. 
        If energyIsFloat is set to True, then automatic scaling and rounding
        will be applied to convert all energies to integers when running graph
        cuts. Then the final energy will be converted back to floats after the
        computation."""
        self.tempArray = np.empty(1, dtype=np.intc)
        self.energyTempArray = np.empty(1, dtype=np.longlong)
        _cgco.gcoCreateGeneralGraph(np.intc(numSites), np.intc(numLabels),
                                    self.tempArray)

        self.handle = self.tempArray[0]
        self.numSites = np.intc(numSites)
        self.numLabels = np.intc(numLabels)
        self.energyIsFloat = energyIsFloat
예제 #3
0
파일: pygco.py 프로젝트: simeks/pyGCO
    def create_general_graph(self, num_sites, num_labels):
        """ Create a general graph with specified number of sites and labels.

        :param num_sites:
        :param num_labels:
        """
        self.temp_array = np.empty(1, dtype=np.intc)
        self.energy_temp_array = np.empty(1, dtype=np.float64)
        _cgco.gcoCreateGeneralGraph(np.intc(num_sites), np.intc(num_labels),
                                    self.temp_array)

        self.handle = self.temp_array[0]
        self.nb_sites = np.intc(num_sites)
        self.nb_labels = np.intc(num_labels)
        self.smooth_cost_fun = None
예제 #4
0
파일: pygco.py 프로젝트: guangbaoshen/pyGCO
    def create_general_graph(self, num_sites, num_labels, energy_is_float=False):
        """ Create a general graph with specified number of sites and labels.
        If energy_is_float is set to True, then automatic scaling and rounding
        will be applied to convert all energies to integers when running graph
        cuts. Then the final energy will be converted back to floats after the
        computation.

        :param num_sites:
        :param num_labels:
        :param energy_is_float:
        """
        self.temp_array = np.empty(1, dtype=np.intc)
        self.energy_temp_array = np.empty(1, dtype=np.longlong)
        _cgco.gcoCreateGeneralGraph(np.intc(num_sites), np.intc(num_labels),
                                    self.temp_array)

        self.handle = self.temp_array[0]
        self.nb_sites = np.intc(num_sites)
        self.nb_labels = np.intc(num_labels)
        self.energy_is_float = energy_is_float
        self.smooth_cost_fun = None