Skip to content

Commit

Permalink
Update predictor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RRobert92 committed Jul 8, 2024
1 parent 6bb19ff commit 9fc96dc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tardis_em/utils/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,11 @@ def log_tardis(self, id_: int, i: Union[str, np.ndarray], log_id: float):
self.tardis_progress(title=self.title, **config)

def save_semantic_mask(self, i):
self.log_prediction.append(f"Semantic Prediction: {i[:-self.in_format]}"
f" | Number of pixels: {np.sum(self.image)}")
with open(join("Predictions", "prediction_log.txt"), "w") as f:
f.write(" \n".join(self.log_prediction))

if self.output_format.startswith("mrc"):
to_mrc(
data=self.image,
Expand Down Expand Up @@ -912,11 +917,13 @@ def save_semantic_mask(self, i):
join(self.am_output, f"{i[:-self.in_format]}_semantic.npy"), self.image
)

self.log_prediction.append(f"Semantic Prediction: {i[:-self.in_format]}")
with open(join("Predictions", "prediction_log.txt"), "w") as f:
def save_instance_PC(self, i):
self.log_prediction.append(
f"Instance Prediction: {i[:-self.in_format]}; Number of segments: {np.max(self.segments[:, 0])}"
)
with open() as f:
f.write(" \n".join(self.log_prediction))

def save_instance_PC(self, i):
if self.output_format.endswith("amSG") and self.predict in [
"Actin",
"Microtubule",
Expand Down Expand Up @@ -1063,12 +1070,6 @@ def save_instance_PC(self, i):
self.segments,
)

self.log_prediction.append(
f"Instance Prediction: {i[:-self.in_format]}; Number of segments: {np.max(self.segments[:, 0])}"
)
with open() as f:
f.write(" \n".join(self.log_prediction))

def _debug(self, id_name: str, debug_id: str):
if self.debug:
if debug_id == "cnn":
Expand Down

0 comments on commit 9fc96dc

Please sign in to comment.