Ajarn - Can fully understand the efforts and time you are putting in to create these contents.......The real value of gold is not known to the one who wears it......It is know to the miners who take out tons and tons of slush to extract 1 ounz of gold........Pranams......You have an amazing sense of sequels.......And I am sure, you are not going to stop the sequels on U-nets with this.......
Thank you sreeni for the labelencoder path, all other places it was simply -1 , but my masks were in color and i just realised that differnce after wathing this tutorial..... super helpful insight.
Hi Sreeni, Many thanks for the very useful materials. I tried your code and have the following question for you: When I tried to do the same as you did in the code, i.e., commenting the class_weight=class_weights, I cannot get a reduction in the loss at all! And when I tried to execute class_weight=class_weights, I am getting "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". Can you please give me some guidance? Appreciated.
Is this on a different data set or same one I showed? If it is the same data set then the same code should work, please make sure you haven’t skipped any steps. Also, try different kernel initializers, optimizer and loss function.
Thank you for your tutorial. I would like to request an open-slide tutorial for generating patches from the whole-slide images. This is very important for the analysis of histopathology images.
Hi Sreeni, I have just a small doubt, is it really a multiclass problem? or is it a multilabel? because as per the definition given in video "140 - What in the world is regression, multi-label, multi-class and binary classification?" for me it's more likely a multilabel problem, or am I getting it wrong? Thanks in advance!
Amazing content my and of many professor of Deep Learning, I think that a nice suggestion to your next videos, could be the addition of the version of the installed libraries and modules in each notebook. That´s it thanks.
Your U-net videos are very helpful for me. I would appreciate if you could produce videos on instance segmentation as well and particularly Mask RCNN model. Thanks a lot. 🙏🙏
Amazing content. Can you please name the tool you used for image analysis? The one with which you checked number of class, histogram, changing contrast and so on.
Thank you very much for your video, it helped a lot. Only thing I need to ask you about is the calculation of the IoU. I have a very unbalanced dataset, and I ran the model on it several times with several different loss functions, including some that are explicitly made to handle data unbalance, but every single time the IoU confusion matrix looks as if my model classified everything as background (i.e. the most common "class"). Since I'm sure the data is correctly labelled and I doubt there can be something wrong with the model especially after running it with different functions, I think there is something wrong with the IoU calculation. Do you have any idea? Thank you.
In this example, there is nothing like background. If you have a background class then that can be assigned a value 0. The way I have written my code, the background would be the 5th class.
Thank you very much for your videos. They have been of immense help for a histopathology cell counting project I am working on. I am trying to investigate the impact of auxiliary outputs on UNets for microscopic cell detection and counting but have been stuck with a bug for over a week now. Most documentation online hasn't helped. My auxiliary outputs use various blocks of the UNet model as inputs as such output different shapes from the original input size of (256,256,3). So the main challenge is how to declare this during training so it takes this into consideration. Error Message obtained: ValueError: Error when checking target: expected aux1 to have shape (32, 32, 1) but got an array with shape (256, 256, 1) Model Summary: Layer (type) Output Shape Param # Connected to ================================================================================================== input_6 (InputLayer) (None, 256, 256, 3) 0 __________________________________________________________________________________________________ ... __________________________________________________________________________________________________ aux1 (Conv2D) (None, 32, 32, 1) 33 activation_74[0][0] __________________________________________________________________________________________________ aux2 (Conv2D) (None, 64, 64, 1) 33 activation_76[0][0] __________________________________________________________________________________________________ aux3 (Conv2D) (None, 128, 128, 1) 33 activation_78[0][0] __________________________________________________________________________________________________ original (Conv2D) (None, 256, 256, 1) 33 activation_72[0][0]
Sir thank you for the video. Can you please help me with this error i am getting with compute class weight. It says compute class weight() takes 1 positional argument but 3 were given.
@@matancadeporco I didn't solve this problem;however, I use a loss function named "weighted categorical_crossentropy" instead. Hope you find this information helpful.
Thank you for the great work! I have one question. Is the number of classes related to the number of colours/categories presented in the masks? If so, that means that in your case it's 4 but it could have been 5 or 20? Do we need to change the code in any way if the number of classes gets too much? Seems I'm having 224....Thank you in advance.
yes depending on color number of classes depends.Yes it could be anything depending on labels 5 or 20. if number of classes is more the model should be robust no need to change the model attempt it and explore if you are having 224 give input shape 224*224*n_channels
What if a computer scientist gets handed images and is asked to develop a semantic segmentation model but doesn't have the masks for the images, just the images?
Great videos. You are working with images which do not have more than 3 channels (3 bands). Do you think is possible use these models with images with more than 3 channels? I'm telling this because I'm working with hyperspectral images.
Yes, of course. I've covered multichannel images in a few other videos, for example search for BraTS videos on my channel. Here is the first one in that series: th-cam.com/video/0Rpbhfav7tE/w-d-xo.html
thanks, Sreeni. Was the original training image carefully segmented in APEER by an expert? or is that job also done with Machine Learning? What is the weight of the EM images you are working with (100MB, 1GB, 10GB, 100GB)? I will follow your channel more closely :)! What kind of filter operations can we do in APEER platform for creating the feature maps to improve segmentation? I ask this final question thinking on QuPath (DoG, LoG, Structure and Hessian filters). Thanks in advance for your answer.
I have watched your videos several times to get my master's thesis right. I have a question, how can I pass the weight information from SegSem to a GAN?
thank you sir your lectures are very helpful. i have been stuck in class weight problems i have tried different methods but still got error. please help me out in this. how could possibly i do it. i have also tried focal loss but no benefit. i get 3D+ dimension error
If I use the iou loss and iou as metric do I have to do class_weighting ? I know that for semantic segmentation the accuracy and the crossentropy loss are not the right ones to use because of the unbalanced data but I use the iou loss and iou metric do I have to use class weighting ?
I had this problem with the class_weight -> ValueError: `class_weight` not supported for 3+ dimensional targets. Do you have any suggestions to solve it?
Your videos are wonderful. I had a problem on the line 88. It said "class_weights = class_weight.compute_class_weight('balanced', np.unique(train_masks_reshaped_encoded), train_masks_reshaped_encoded) *** TypeError: compute_class_weight() takes 1 positional argument but 3 were given" Could you help me?
Hello! TH-cam recommended me this video so I started with this one, but I can see that you have more than 208 ! I have one question, maybe there is a video where you explain this. If so, please recommend me that video. If keras works with jpg or png, is it possible to work with .tiff with reflectance units (0-1) ? Thank you so much.
As usual, your videos make life very easy for researchers. I have a question regarding class weights, when I uncommented the class_weight part in the model fitting, it returned an error that class_weights has to be a dictionary, something like this (on my own dataset): Class weights are...: {0: 0.4280686779466047, 1: 1.54654951724371, 2: 0.40951813587110275, 3: 42.324187597545105, 4: 1.5749410555965808, 5: 2.2925788973162344, 6: 2.080430679675916} even upon changing the class_weights into a dictionary, I faced another issue: `class_weight` not supported for 3+ dimensional targets meaning that my y_test_cat is a 3-D matrix which is not supported for class_weights. References suggested to use "sample weights" instead of class_weights any suggestions on how to solve this issue? Again, Many thanks for your amazing videos.
@@mqfk3151985 after some research, it seems that you cannot apply weight to 2D array. The model output is (height, width, number of class), and should be flatten as (height * width, number of class) for the weights to be applied. Will try that tomorrow and tell you if it helps
Where can i get a video that explains datasets - I) Kidney (RCC) (II) Triple Negative Breast Cancer (TNBC) (III) MoNuSeg-2018 and many other nuclei segmentation datasets ?
Using imageJ, how can I save my semantic labels in only one mask? Like in this vide where you get a single mask but represented with diferrent gray-scale levels
Had to translate to find out what that means, apparently Thank you in Indonesian. Thank you too for watching the video, I hope you found it to be useful and educational.
Thanks for the great content. However, I noticed that class_weight does not work for multiclass segmentation. It keeps throwing an error when I run the script you shared. Could there be a solution for this?
I did not test class_weight for multiclass. In fact, I recommend using focal loss for multiclass. You can also use a combination of focal loss and dice loss and for dice you can provide class weights. This is probably the easiest way to handle this. In general, focal loss did a great job for my datasets with multiple classes.
Nice class sir. SIr, Can you please make some videos like how to read a scientific research paper and how we can get their results by performing our own code or reading that articles. It will really help many of us.
Needed this so much. Seems like every time I run into a problem with my research you put out a video answering my prayers. Thanks Sreeni.
One of the best channels for Research Students of Computer Vision discipline.
Thank you :)
This channel deserves millions of subscribers. Thanks for the amazing contents.
true very true --- he can sell this course for at least 100 dollars ...but he has done it for free ...
Exactly!
Exactly what I was looking for, you are a very knowledgeable person with a great talent for explaining things!!! Please don't stop!
Thank you so much! I was stock at my model and I couldn't figure out y for weeks! Thanks to u and ur straightforward videos, I fixed the problem!
Ajarn - Can fully understand the efforts and time you are putting in to create these contents.......The real value of gold is not known to the one who wears it......It is know to the miners who take out tons and tons of slush to extract 1 ounz of gold........Pranams......You have an amazing sense of sequels.......And I am sure, you are not going to stop the sequels on U-nets with this.......
The only word : Great! please keep continue Sir. thank you so much.
Wow the best explain of these concepts I have seen in a long time. Thanks for this
Thanks for Multiclass segmentation. In Segmentation or even Image related Deep Learning your Videos are best.....
Thank you sreeni for the labelencoder path, all other places it was simply -1 , but my masks were in color and i just realised that differnce after wathing this tutorial..... super helpful insight.
Best TH-cam channel for deep learning researchers.
I'm glad you think so :)
Sreeni thank you so much for all the work you put into these videos. It has helped me so much get started with segmentation
You are so welcome!
Hi Sreeni,
Many thanks for the very useful materials. I tried your code and have the following question for you:
When I tried to do the same as you did in the code, i.e., commenting the class_weight=class_weights, I cannot get a reduction in the loss at all! And when I tried to execute class_weight=class_weights, I am getting "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". Can you please give me some guidance? Appreciated.
Is this on a different data set or same one I showed? If it is the same data set then the same code should work, please make sure you haven’t skipped any steps. Also, try different kernel initializers, optimizer and loss function.
class_weight=class_weights is NOT working either on the given dataset or any other type of dataset. Can you kindly give us any suggestions?
Thank you. Your tutorials are life savers for me
I've just found what I was looking for.
Thank you!
Glad I could help!
Thank you for your tutorials and lectures.
My pleasure.
Thank you, your tutorials are one of the best.
Thank you for your tutorial. I would like to request an open-slide tutorial for generating patches from the whole-slide images. This is very important for the analysis of histopathology images.
he did already, follow this link:
th-cam.com/video/7IL7LKSLb9I/w-d-xo.html
thanks I was just working on a multiclass segmentation with Unet
Thanks Sreeni. You always bring new ideas to the AI world.
My pleasure 😊
Hi Sreeni, Thanks for great video. How does one generate multiclass masks from already annotated images
i would also like to know.
thanks for the contribution, appreciated.
i wish you showed how to use focal loss
Finally video explained to details. Thanks
this channel is love !! supported me a lot
Happy to hear that!
I needed this.
Great lectures, I follow up with your series.
Great to hear!
I am a simple man. I see your new video I press like!
Thank you soo much, i was looking for the exact same stuff and this single video helped me alot.
Glad it helped
Hi Sreeni, I have just a small doubt, is it really a multiclass problem? or is it a multilabel? because as per the definition given in video "140 - What in the world is regression, multi-label, multi-class and binary classification?" for me it's more likely a multilabel problem, or am I getting it wrong? Thanks in advance!
Amazing content my and of many professor of Deep Learning, I think that a nice suggestion to your next videos, could be the addition of the version of the installed libraries and modules in each notebook.
That´s it thanks.
Thank you for your videos. They are very much helpful.
Thanks for the free content through your channel!
Glad you like them!
Your U-net videos are very helpful for me.
I would appreciate if you could produce videos on instance segmentation as well and particularly Mask RCNN model. Thanks a lot. 🙏🙏
Great job srini, I'm learning alot
hello, thank you for this great tutorial. I want to download the exactly dataset but in the given link there are a few images. What should I do?
Great!! I was in need of it badly :) Great work. !!
Thank you so much, this video is really helpful
Can you please tell us how I can use dice coefficient as the loss function for multiclass segmentation too?
Thanks sir, for this wonderful tutorial. I wanted to know what is the software that you were using to view the masks?
Thanks for the video it was very helpful!
Fantastic Explanation. Thank You.
You are welcome!
Why patching the image is preferred rather than resizing in segementation ?
Can you please name the tool you used for image analysis?
This class helped me sooo much! Thanks a lot s2
Thank you for the amazing tutorial!!
what if the dataset's images were not grayscale and had 3 channels? could you please help on how train that kind of dataset
Amazing content. Can you please name the tool you used for image analysis? The one with which you checked number of class, histogram, changing contrast and so on.
I like the way that you explain the concept... I will subscribe for future excellent content.... Thank you
thanks, i am waiting for this and requested also
Thank you so much. 👏👏👏
Your videos are great, thank you!
Sir, you are the best!!!!!
Thank you!!
can u explain how to make that mask dataset?
Hey, is there a way we can get access to the trained weights?
Thank you very much for your video, it helped a lot. Only thing I need to ask you about is the calculation of the IoU. I have a very unbalanced dataset, and I ran the model on it several times with several different loss functions, including some that are explicitly made to handle data unbalance, but every single time the IoU confusion matrix looks as if my model classified everything as background (i.e. the most common "class"). Since I'm sure the data is correctly labelled and I doubt there can be something wrong with the model especially after running it with different functions, I think there is something wrong with the IoU calculation. Do you have any idea? Thank you.
Thank you for the video. A question, 4 classes including background?
In this example, there is nothing like background. If you have a background class then that can be assigned a value 0. The way I have written my code, the background would be the 5th class.
@@DigitalSreeni 👍.
Thank you so much! How can I do multiclass instance segmentation in unet?
Do make a video on training the nnUnet and UNet with transformers using 3D dataset
Thank you very much for your videos. They have been of immense help for a histopathology cell counting project I am working on. I am trying to investigate the impact of auxiliary outputs on UNets for microscopic cell detection and counting but have been stuck with a bug for over a week now. Most documentation online hasn't helped.
My auxiliary outputs use various blocks of the UNet model as inputs as such output different shapes from the original input size of (256,256,3). So the main challenge is how to declare this during training so it takes this into consideration.
Error Message obtained: ValueError: Error when checking target: expected aux1 to have shape (32, 32, 1) but got an array with shape (256, 256, 1)
Model Summary:
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_6 (InputLayer) (None, 256, 256, 3) 0
__________________________________________________________________________________________________
...
__________________________________________________________________________________________________
aux1 (Conv2D) (None, 32, 32, 1) 33 activation_74[0][0]
__________________________________________________________________________________________________
aux2 (Conv2D) (None, 64, 64, 1) 33 activation_76[0][0]
__________________________________________________________________________________________________
aux3 (Conv2D) (None, 128, 128, 1) 33 activation_78[0][0]
__________________________________________________________________________________________________
original (Conv2D) (None, 256, 256, 1) 33 activation_72[0][0]
Wow, do you plan to roll out tutorials on lits?
Thank you for your content!
Sir thank you for the video. Can you please help me with this error i am getting with compute class weight.
It says compute class weight() takes 1 positional argument but 3 were given.
May be this video helps: th-cam.com/video/QntLBvUZR5c/w-d-xo.html
Thank you so much, this video is amazing
class_weight in .fit is not working it says "`class_weight` not supported for 3+ dimensional targets".
Did you occur the error of " 'class_weight' not support for 3+ dimensional targets " when using class_weight?
Yes. For multiclass I recommend dice loss where you supply class weights or use focal loss that works well without providing class weights.
@@DigitalSreeni Thanks for your reply.
@@connielee4359 have u solve this? i'm stuck on this
@@matancadeporco I didn't solve this problem;however, I use a loss function named "weighted categorical_crossentropy" instead. Hope you find this information helpful.
Why hot-encoding is used here? What is the performance difference between this and having normal interger number's?
Amazing explanation
Thank you for the great work! I have one question. Is the number of classes related to the number of colours/categories presented in the masks? If so, that means that in your case it's 4 but it could have been 5 or 20? Do we need to change the code in any way if the number of classes gets too much? Seems I'm having 224....Thank you in advance.
yes depending on color number of classes depends.Yes it could be anything depending on labels 5 or 20.
if number of classes is more the model should be robust no need to change the model attempt it and explore
if you are having 224 give input shape 224*224*n_channels
What if a computer scientist gets handed images and is asked to develop a semantic segmentation model but doesn't have the masks for the images, just the images?
how can detrmine the number of class if i used UCF data set
Awesome!! Thank you so much...
Thanks Sreeni, this is great!
Great videos. You are working with images which do not have more than 3 channels (3 bands). Do you think is possible use these models with images with more than 3 channels? I'm telling this because I'm working with hyperspectral images.
Yes, of course. I've covered multichannel images in a few other videos, for example search for BraTS videos on my channel. Here is the first one in that series: th-cam.com/video/0Rpbhfav7tE/w-d-xo.html
@@DigitalSreeni Thank you so much.
thanks, Sreeni. Was the original training image carefully segmented in APEER by an expert? or is that job also done with Machine Learning? What is the weight of the EM images you are working with (100MB, 1GB, 10GB, 100GB)? I will follow your channel more closely :)! What kind of filter operations can we do in APEER platform for creating the feature maps to improve segmentation? I ask this final question thinking on QuPath (DoG, LoG, Structure and Hessian filters). Thanks in advance for your answer.
I have watched your videos several times to get my master's thesis right. I have a question, how can I pass the weight information from SegSem to a GAN?
thank you sir your lectures are very helpful. i have been stuck in class weight problems i have tried different methods but still got error. please help me out in this. how could possibly i do it. i have also tried focal loss but no benefit. i get 3D+ dimension error
How are the different classes (labels) for the classes of images specified? Is there a specific directory structure for that?
If I use the iou loss and iou as metric do I have to do class_weighting ? I know that for semantic segmentation the accuracy and the crossentropy loss are not the right ones to use because of the unbalanced data but I use the iou loss and iou metric do I have to use class weighting ?
Sir we r using same data for validation as well as same data for testing “x_test”,”y_test_cat”
Excellent explanation !!
I had this problem with the class_weight -> ValueError: `class_weight` not supported for 3+ dimensional targets. Do you have any suggestions to solve it?
please help me implement this unet on hyperspectral images
Thank you very much! One question, I can only see 2 images under the folder 128_patches. did I miss anything here?
could you upload a mask RCNN for the instance image segmentation?
hello,
why the sgd optimizer gives bad result. it can predict only 3 classes while adam can predict all class
thank you
Can you help get ground truth i.e mask image from a raw CXR image for segmentation using Unet..
thanks a lot for your work!
There is one thing, i am not sure about , why you load all data in ram first instead of using data loader
Your videos are wonderful.
I had a problem on the line 88. It said "class_weights = class_weight.compute_class_weight('balanced',
np.unique(train_masks_reshaped_encoded),
train_masks_reshaped_encoded)
*** TypeError: compute_class_weight() takes 1 positional argument but 3 were given"
Could you help me?
Hello! TH-cam recommended me this video so I started with this one, but I can see that you have more than 208 ! I have one question, maybe there is a video where you explain this. If so, please recommend me that video.
If keras works with jpg or png, is it possible to work with .tiff with reflectance units (0-1) ?
Thank you so much.
Could you do a video about predicting continuous variable using Unet? Thanks!
As usual, your videos make life very easy for researchers.
I have a question regarding class weights, when I uncommented the class_weight part in the model fitting, it returned an error that class_weights has to be a dictionary, something like this (on my own dataset):
Class weights are...: {0: 0.4280686779466047,
1: 1.54654951724371,
2: 0.40951813587110275,
3: 42.324187597545105,
4: 1.5749410555965808,
5: 2.2925788973162344,
6: 2.080430679675916}
even upon changing the class_weights into a dictionary, I faced another issue:
`class_weight` not supported for 3+ dimensional targets
meaning that my y_test_cat is a 3-D matrix which is not supported for class_weights. References suggested to use "sample weights" instead of class_weights
any suggestions on how to solve this issue?
Again, Many thanks for your amazing videos.
Hi, I face the same problem, did you manage to solve it ? :)
@@finlyk not yet, I was hoping to get some answer. I may end up trying to solve it myself
@@mqfk3151985 after some research, it seems that you cannot apply weight to 2D array. The model output is (height, width, number of class), and should be flatten as (height * width, number of class) for the weights to be applied. Will try that tomorrow and tell you if it helps
I didn't managed to fix it unfortunately.. would appreciate any help if you try to handle the issue :)
does anyone solve this problem? i'm stuck here
Where can I find and download the dataset? Is this available for public/students
Where can i get a video that explains datasets - I) Kidney (RCC) (II) Triple Negative
Breast Cancer (TNBC) (III) MoNuSeg-2018 and many other nuclei segmentation datasets ?
Using imageJ, how can I save my semantic labels in only one mask? Like in this vide where you get a single mask but represented with diferrent gray-scale levels
i think os.join is reduntant here, please correct me if i wrong.
Terimakasih banyak sir
Had to translate to find out what that means, apparently Thank you in Indonesian. Thank you too for watching the video, I hope you found it to be useful and educational.
Thanks for the great content. However, I noticed that class_weight does not work for multiclass segmentation. It keeps throwing an error when I run the script you shared. Could there be a solution for this?
I did not test class_weight for multiclass. In fact, I recommend using focal loss for multiclass. You can also use a combination of focal loss and dice loss and for dice you can provide class weights. This is probably the easiest way to handle this. In general, focal loss did a great job for my datasets with multiple classes.
Sir how to segment medical images like retinal image
Nice class sir. SIr, Can you please make some videos like how to read a scientific research paper and how we can get their results by performing our own code or reading that articles. It will really help many of us.