Skip to content
Snippets Groups Projects
Commit e1410571 authored by Levecque Etienne's avatar Levecque Etienne
Browse files

feat: use the config seed for the search

parent 6c3d5324
No related merge requests found
......@@ -84,7 +84,7 @@ class Image:
if self.rng is None:
self.rng = np.random.RandomState()
def search_antecedent(self, max_iter, shared_dict=None, task_id=None, verbose=False):
def search_antecedent(self, max_iter, shared_dict=None, task_id=None, verbose=False, rng=None):
self.filter_blocks()
if self.pipeline.n == 1 and self.is_jpeg and not self.is_grayscale:
......@@ -96,7 +96,7 @@ class Image:
for i, block in enumerate(blocks):
self.update_shared_dict(shared_dict, task_id, i, n)
if self.pipeline not in block.status:
block.search_antecedent(self.pipeline, max_iter, shared_dict, task_id, verbose)
block.search_antecedent(self.pipeline, max_iter, shared_dict, task_id, verbose, rng)
def update_shared_dict(self, shared_dict, task_id, i, n, completed=0, total=0):
if shared_dict is not None and task_id is not None:
......@@ -106,7 +106,7 @@ class Image:
"completed": completed,
"total": total}
def search_antecedent_independent_channel(self, max_iter, shared_dict=None, task_id=None, verbose=False):
def search_antecedent_independent_channel(self, max_iter, shared_dict=None, task_id=None, verbose=False, rng=None):
names = [pipe.name for pipe in self.pipeline]
qualities = [pipe.quality for pipe in self.pipeline]
grayscale_pipeline = create_pipeline(names, qualities, grayscale=True, target_is_dct=True)
......@@ -126,7 +126,7 @@ class Image:
iterations.append(0)
continue
antecedent = block.search_antecedent(grayscale_pipeline, max_iter, shared_dict, task_id, verbose)
antecedent = block.search_antecedent(grayscale_pipeline, max_iter, shared_dict, task_id, verbose, rng)
iteration = block.iterations[grayscale_pipeline]
if antecedent is None:
antecedent = -np.ones((1, 8, 8))
......
......@@ -101,7 +101,7 @@ def handle_image(filename, config, shared_dict, task_id, verbose):
img.search_antecedent(max_iter_heuristic, shared_dict, task_id, verbose, rng)
if search_config['gurobi_solver']['use']:
img.search_antecedent_ilp(search_config['gurobi_solver'], shared_dict, task_id, verbose, rng)
img.search_antecedent_ilp(search_config['gurobi_solver'], shared_dict, task_id, verbose)
return img
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment