def test_empty_pointcloud(self): """ The pointcloud is sometimes returned empty. It seems to be random and about 1/10 of the time We test here the stability. """ test_model = SketchupModel.find_google_id("fb01ac920e6b68fd7236c5b88164c0b8") number_of_attempt = 10 for i in range(number_of_attempt): print "Compute cloud {} on {}".format(i, number_of_attempt) # Generate the pointcloud PartialView.compute_all_views( test_model )
def test_empty_pointcloud(self): """ The pointcloud is sometimes returned empty. It seems to be random and about 1/10 of the time We test here the stability. """ test_model = SketchupModel.find_google_id( "fb01ac920e6b68fd7236c5b88164c0b8") number_of_attempt = 10 for i in range(number_of_attempt): print "Compute cloud {} on {}".format(i, number_of_attempt) # Generate the pointcloud PartialView.compute_all_views(test_model)
def _get_example_matrix(self, use_entropy): """ Return the input matrix of example (X). """ X = numpy.zeros([0, SHAPE_DISTRIBUTION_SIZE]) Y = numpy.array([]) W = numpy.array([]) # Weights of the samples for idx, (category, model_ids) in (enumerate( self.dict_categories.items())): for model_id in model_ids: model = SketchupModel.find_google_id(model_id) if model.partialview_set.count() == 0: PartialView.compute_all_views(model) (x, w) = self._get_model_example_matrix(model, use_entropy) y = numpy.array([idx for _ in range(x.shape[0])]) X = numpy.vstack([X, x]) Y = numpy.concatenate([Y, y]) W = numpy.concatenate([W, w]) return (X, Y, W)
def _get_example_matrix(self, use_entropy): """ Return the input matrix of example (X). """ X = numpy.zeros([0, SHAPE_DISTRIBUTION_SIZE]) Y = numpy.array([]) W = numpy.array([]) # Weights of the samples for idx, (category, model_ids) in (enumerate(self.dict_categories.items())): for model_id in model_ids: model = SketchupModel.find_google_id(model_id) if model.partialview_set.count() == 0: PartialView.compute_all_views(model) (x, w) = self._get_model_example_matrix(model, use_entropy) y = numpy.array([idx for _ in range(x.shape[0])]) X = numpy.vstack([X, x]) Y = numpy.concatenate([Y, y]) W = numpy.concatenate([W, w]) return (X, Y, W)