Python src.graph_utils.rng_next_goal_rejection_sampling() Examples
The following are 9
code examples of src.graph_utils.rng_next_goal_rejection_sampling().
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
src.graph_utils
, or try the search function
.

Example #1
Source File: nav_env.py From DOTA_models with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #2
Source File: nav_env.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #3
Source File: nav_env.py From Gun-Detector with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #4
Source File: nav_env.py From hands-detection with MIT License | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #5
Source File: nav_env.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #6
Source File: nav_env.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #7
Source File: nav_env.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #8
Source File: nav_env.py From models with Apache License 2.0 | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)
Example #9
Source File: nav_env.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _debug_save_hardness(self, seed): out_path = os.path.join(self.logdir, '{:s}_{:d}_hardness.png'.format(self.building_name, seed)) batch_size = 4000 rng = np.random.RandomState(0) start_node_ids, end_node_ids, dists, pred_maps, paths, hardnesss, gt_dists = \ rng_next_goal_rejection_sampling( None, batch_size, self.task.gtG, rng, self.task_params.max_dist, self.task_params.min_dist, self.task_params.max_dist, self.task.sampling_distribution, self.task.target_distribution, self.task.nodes, self.task_params.n_ori, self.task_params.step_size, self.task.distribution_bins, self.task.rejection_sampling_M) bins = self.task.distribution_bins n_bins = self.task.n_bins with plt.style.context('ggplot'): fig, axes = utils.subplot(plt, (1,2), (10,10)) ax = axes[0] _ = ax.hist(hardnesss, bins=bins, weights=np.ones_like(hardnesss)/len(hardnesss)) ax.plot(bins[:-1]+0.5/n_bins, self.task.target_distribution, 'g') ax.plot(bins[:-1]+0.5/n_bins, self.task.sampling_distribution, 'b') ax.grid('on') ax = axes[1] _ = ax.hist(gt_dists, bins=np.arange(self.task_params.max_dist+1)) ax.grid('on') ax.set_title('Mean: {:0.2f}, Median: {:0.2f}'.format(np.mean(gt_dists), np.median(gt_dists))) with fu.fopen(out_path, 'w') as f: fig.savefig(f, bbox_inches='tight', transparent=True, pad_inches=0)