Skip to content

Fix crash when no cell candidates are detected#595

Open
tanishaa7 wants to merge 3 commits intobrainglobe:mainfrom
tanishaa7:fix-empty-candidates-344
Open

Fix crash when no cell candidates are detected#595
tanishaa7 wants to merge 3 commits intobrainglobe:mainfrom
tanishaa7:fix-empty-candidates-344

Conversation

@tanishaa7
Copy link
Copy Markdown

This PR fixes a crash that occurs when no cell candidates are detected.

Closes #344

)


class EpochEndCallback(keras.callbacks.Callback):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you need this new class. Keras provides a built-in LambdaCallback . Something like:

  callbacks.append(LambdaCallback(                                                                                                                                                                                                                                                                                                                                                            
      on_epoch_end=lambda epoch, logs: progress_callback(
          f"Training epoch {epoch+1}/{epochs}", epoch+1, epochs                                                                                                                                                                                                                                                                                                                               
      )                                                                 
  ))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that the class pattern is used elsewhere as well. I would still keep this flagged, I would think the simple append is better.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, @aymuos15. You're right that LambdaCallback is cleaner. I changed it and add the new code. Thank you. Please let me know if it is fine now

@tanishaa7 tanishaa7 force-pushed the fix-empty-candidates-344 branch from d9bf4fd to 0b5e05e Compare March 4, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error raised when no cell candidates are detected.

2 participants