Skip to content

Conversation

daviddaytw
Copy link

Hi,

Thank you for creating such a valuable tool! My team and I have been using the custom features classifier widget to classify nuclei, and we've found it very effective. However, we needed to apply our trained model across multiple images, which isn’t currently supported in napari-apoc. To address this, I forked the repository and added the functionality, and I thought others might benefit from it as well, so I've submitted a PR for your review.

Thank you for considering this addition, and please let me know if there's anything further I can do to improve it!

Best,
David

@daviddaytw
Copy link
Author

Hi @haesleinhuepf, would you like to take a look at this one?

@haesleinhuepf
Copy link
Owner

Hey @daviddaytw Yes! Just give me some days. I'm travelling. ;-)

@daviddaytw
Copy link
Author

@haesleinhuepf Any thoughts on this one?

@haesleinhuepf
Copy link
Owner

Hi @daviddaytw ,

I haven't found the time yet to test this. Out of curiousity: If you press the inference button, there is no mechansim checking that the same columns are selected, or?

We definitely have to write something in the documentation (readme.md) to make this modification useful for others.

Thanks fo your time!

Best,
Robert

@haesleinhuepf
Copy link
Owner

Also, it should be possible to read out the features of a classifier and use this list instead of a user-selection: https://github.com/haesleinhuepf/apoc/blob/fcec43837445514eebe6897376465867bf450045/apoc/_table_row_classifier.py#L57

Or we check if the user selection is identical with that list... No sure how to deal with this. Opinions welcome!

@daviddaytw
Copy link
Author

Hi @haesleinhuepf,

Thank you for your feedback.

There is no mechanism for checking that the same columns are selected, but I think having that is a good idea.
I also agree that we should detect features without the user's selection.

In this case, I suggest using two QT boxes, one for training and one for inferencing. Do you think this is a good approach?

Best,
David

@haesleinhuepf
Copy link
Owner

Yes, that makes sense! Plus: I presume a QWidget is not even necessary if this pattern can be applied to object classification:

@register_function(menu="Segmentation / labeling > Semantic segmentation (apply pretrained, APOC)")
@time_slicer
@wrap_api
def apply_pixel_classification(image: "napari.types.ImageData",
model_filename : str = "PixelClassifier.cl",
viewer: napari.Viewer = None) -> "napari.types.LabelsData":
clf = PixelClassifier(opencl_filename=model_filename)
result = clf.predict(image=[image])
return result

@daviddaytw daviddaytw changed the title Add inference button for custom features classifier widget. Add inference ability for custom features classifier. Dec 8, 2024
@daviddaytw
Copy link
Author

Hi @haesleinhuepf,

Thank you for the insight.

I see the reason you want to implement it following the pattern of other functions in _function.py.
It simplifies the code, but I am worried about the usability if we go this way.

The primary issue is the file selection options.
In other functions you implemented, there is no file selector. Users will need to specify the file path. While it is okay for technical people like us, it will cause a lot of confusion for my non-technical colleagues.

I think the best way is to have two boxes in the custom feature classifier panel. If you agree with this, I can go ahead and implement it.

Best,
David

@haesleinhuepf
Copy link
Owner

The primary issue is the file selection options.
In other functions you implemented, there is no file selector.

Do you think this PathLike thing here would solve this problem?
https://github.com/haesleinhuepf/napari-skimage-regionprops/blob/2863eb0d16d79effd112c2f3c1bb89a5c0a8b14d/napari_skimage_regionprops/_load_csv.py#L12

@daviddaytw
Copy link
Author

daviddaytw commented Dec 15, 2024

Hi @haesleinhuepf ,

I added a function and reverted the custom feature classifier widget modification.
I tested it in our use case, and it works fine.

Best,
David

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.

2 participants