Comments (7)
Yes I think it's on the right track. Probably the base classes such as HENormalizeer, MacenkoNormalizer etc should be common to both modules, maybe in a base
module.
from torchstain.
I think the entire torchstain library could be installed, and then the user will be able to specify backend="torch"
or backend="tensorflow"
when instantiating a normalizer.
It might event be useful to have a global method such as torchstain.set_backend()
to set a default backend instead.
The imports in torchstain should be done based on the backend specified by the user (by doing "pip install torchstain[tf]" the user is just saying that the pytorch dependency is not necessary and won't be installed).
from torchstain.
The idea of having separate modules as in your branch is good, as we also need to port the different utilities from pytorch to tf. I tried to setup a project (you have write access to it) so that we can keep track of all the features
from torchstain.
I've gotten a bit further now. It is not finished yet, but do you approve of the design, @carloalbertobarbano?
https://github.com/andreped/torchstain/tree/backends/torchstain
Need to get the pip install torchstain[backend]
working somehow as well. As well as, verifying that you are able to install torchstain with a specific backend, without needing the other; if you install with torch, you do not install tf at all, and vice versa.
However, there are some duplicate code between the subpackages, so there are probably improvements to be made.
from torchstain.
Good idea. The problem is that when I install, I wish to install some specific subpackage, without the other, so it was easier to include the base both places, but I agree. Having a base subpackage is more scalable.
from torchstain.
Ok, I think I managed to get it properly working now. It was a lot more annoying to do than first anticipated, due to packages/modules, dependencies, and imports operate in Python. At least all the CI tests works fine, and you can use the tool with torch without needing tensorflow, and vice versa. Same usage as before. Just choose which backend to use to the MacenkoNormalizer
class. I also made a separate base subpackage as discussed.
The last thing that remains is to be able to simplify the imports, which I believe you might have an idea of how to do. I didn't find a simple way, probably some simple __init__.py
magic needed :P
Currently, for using the MacenkoNormalizer, you need to run: torchstain.base.normalizers.macenko_normalizer.MacenkoNormalizer()
, but ideally you should just run: torchstain.MacenkoNormalizer()
.
For debugging, please, see my current implementation:
https://github.com/andreped/torchstain/tree/backends/torchstain
I will make a PR and you can make comments and reviews there.
from torchstain.
Resolved in #16
from torchstain.
Related Issues (20)
- Support for Vahadane normalization HOT 2
- Update runtimes HOT 2
- Conda compatibility?
- Update About and tags HOT 1
- Fix tf implementaton of percentile HOT 1
- Releases not showing anymore?
- Support for Reinhard HOT 2
- Support for Modified Reinhard HOT 5
- Support for Jax HOT 24
- Support for torch.linalg.lstsq HOT 3
- Crash when calling MacenkoNormalizer.fit with tensorflow backend HOT 12
- Whole Slide Images HOT 7
- Add stain augmentation alternative HOT 1
- Documentations? HOT 1
- No GPU acceleration in torch backend
- Typo in rgb2lab transform HOT 2
- IndexError: kthvalue(): Expected reduction dim 0 to have non-zero size. HOT 3
- Add unit tests? HOT 13
- Add Zenodo DOI HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchstain.