Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using all three color spaces #4

Open
chokevin8 opened this issue Jun 19, 2023 · 4 comments
Open

Using all three color spaces #4

chokevin8 opened this issue Jun 19, 2023 · 4 comments

Comments

@chokevin8
Copy link

So I calculated my dataset statistics by using dataset_statistics.py for all three color spaces (RGB, HSV, HED), and then created a yaml file that looked exactly like this. When trying to use this, do I just fix this line (line 50) so that self.color_space is selected randomly out of the three color spaces? Then, when I put it inside my transforms function like below, the transforms will select one color space, augment & normalize and then re-normalize with Reinhard method? I'd appreciate some help with this, thanks!

#randstain_all.yaml is my yaml folder
val_transforms = transforms.Compose([RandStainNA(
yaml_file="randstainna_all.yaml",
std_hyper=-0.3,
probability=0.8,
distribution="normal",
is_train=True
)])

@chokevin8
Copy link
Author

@yiqings @lyl010221 @lyl750697268 Hello, I would really appreciate any guidance from you guys, thank you in advance!

@yiqings
Copy link
Owner

yiqings commented Aug 27, 2023

@chokevin8 Thanks for your input. Could you specify your questions, I am afraid I didn't really catch your question.

@chokevin8
Copy link
Author

@yiqings Sorry for a belated response, I've looked back at this and the problem was in the .yaml file. I generated my own .yaml file after calculating the statistics for my own training dataset. I have the same exact .yaml file like yours here. The problem is that for color_space = Random, it will create an error in the RandStainNA class in the randstainna.py file rightly so, since Random is not a color_space. To recreate your work, do I just need to create a random number generator with equal probability p = 1/3 so that everytime the class is called one of the three color spaces are selected?

@TumVink
Copy link

TumVink commented Mar 25, 2024

Heyy @chokevin8
I want to do the same thing as you. After looking into the very wrapped package folders, I found that the authors have implemented a method to augment and norm the images into random color space (HSV HED LAB).

In lines 121-145 of file "/classification/timm/data/transforms_factory.py" you may find this function. The probabilities of norm_jitter are different depending on the settings, for example in "r/classification/[scripts_CRC_final]", you may find the p=0.5 in the last exp-settings.

But please remember: this is not an official reply from the package author, though I like this work a lot ;)

Jingsong

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

No branches or pull requests

3 participants