230 - Semantic Segmentation of Landcover Dataset using U-Net

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024
  • Semantic Segmentation of Landcover Dataset ​by loading images in batches from the drive​.
    Code generated in the video can be downloaded from here:
    github.com/bns...
    For all code:
    github.com/bns...
    Dataset from: landcover.ai/
    Labels:
    0: Unlabeled background ​
    1: Buildings​
    2: Woodlands​
    3: Water​
    You can use any U-net but this code demonstrates the use of pre-trained encoder in the U-net - available as part of segmentation models library.
    To install the segmentation models library: pip install -U segmentation-models
    If you are running into generic_utils error when loading segmentation models library watch this video to fix it: • Python tips and tricks... .
    Prepare the data first:
    1. Read large images and corresponding masks, divide them into smaller patches. And write the patches as images to the local drive.
    2. Save only images and masks where masks have some decent amount of labels other than 0. Using blank images with label=0 is a waste of time and may bias the model towards unlabeled pixels.
    3. Divide the sorted dataset from above into train and validation datasets.
    4. You have to manually move some folders and rename them appropriately if you want to use ImageDataGenerator from keras.
    After training, you can use the smooth blending process to segment large images.

Комментарии • 167

  • @jacobusstrydom7017
    @jacobusstrydom7017 3 года назад +3

    Thanks!

    • @DigitalSreeni
      @DigitalSreeni  3 года назад +1

      Thank you very much Jacobus, I really appreciate your contribution.

  • @DigitalSreeni
    @DigitalSreeni  3 года назад +6

    Please like the video if you like the content. If you feel extra generous, click the 'THANKS' button.

    • @mahajabri840
      @mahajabri840 2 года назад +1

      Thank you so much for this tutorial. It is amazing. While running the code I got an error saying StopIteration while working with the generator next() how can I solve this ? thank you

  • @Hapvr
    @Hapvr Год назад +2

    We should call you semantic sreeni 😀😀😀 so helpful

  • @adrirg94
    @adrirg94 7 месяцев назад +2

    If you are getting the error "IndexError: index 4 is out of bounds for axis 1 with size 4" when running the train_generator part, note that if you are using the new version of the Landcover dataset, you have to change the number of classes to 5, instead of 4.
    num_class = 5 and n_classes = 5
    Reference to the issues in the repository.

  • @leothomas8511
    @leothomas8511 5 месяцев назад

    Amazing job. It would be wonderful if you can provide us with some tutorials for segmenting images of more than 3 channels.🙏🙏🙏

  • @fariyasyed5756
    @fariyasyed5756 3 года назад +1

    Thank you so much sir, your method of teaching and explaining each and every thing in the code is highly appreciated. I'm looking forward to learn much more from you.

  • @souvikdatta5686
    @souvikdatta5686 2 года назад +3

    For anyone who might still be struggling with "IndexError: index 4 is out of bounds for axis 1 with size 4"
    Change the num_classes in the Original Code from 4 to 5 ----->
    Original Code Snippet: train_img_gen = trainGenerator(train_img_path, train_mask_path, num_class=4)
    val_img_gen = trainGenerator(val_img_path, val_mask_path, num_class=4)
    New Code Snippet: train_img_gen = trainGenerator(train_img_path, train_mask_path, num_class=5)
    val_img_gen = trainGenerator(val_img_path, val_mask_path, num_class=5)

    • @syalwadea
      @syalwadea 2 года назад

      thank you 🥺🥺🥺🥺🥺

  • @svenmalama8141
    @svenmalama8141 3 года назад

    Thanks Sreeni, this was super useful. I had trouble using a generator for multiclass segmentation to read images from directory.

  • @fawad_chukscolab4656
    @fawad_chukscolab4656 3 года назад +2

    Thank you Dr. Sreeni, for your tutorials, cannot find anything better than this online. Can I use the same frame work with Vgg or Inception as Backbone?

  • @worakanlasudee2078
    @worakanlasudee2078 2 года назад +2

    I have error at [44] TypeError
    Traceback (most recent call last)
    in ()
    1 temp_img = cv2.imread("data/images/M-34-51-C-d-4-1.tif") #3 channels / spectral bands
    ----> 2 plt.imshow(temp_img[:,:,1]) #View each channel...
    3 temp_mask = cv2.imread("data/masks/M-34-51-C-d-4-1.tif") #3 channels but all same.
    4 labels, count = np.unique(temp_mask[:,:,0], return_counts=True) #Check for each channel. All chanels are identical
    5 print("Labels are: ", labels, " and the counts are: ", count)
    TypeError: 'NoneType' object is not subscriptable

  • @불루이보스
    @불루이보스 2 года назад +1

    Thank you So much! Amazing Framework for my work. I really appreciate it.

    • @DigitalSreeni
      @DigitalSreeni  2 года назад +2

      You're very welcome! Kamsahamnida, I assume means thank you :)

    • @불루이보스
      @불루이보스 2 года назад

      In this vidio, 29:00, To use resnet34 backbone, we need to preprocessing the data the way exactly same before. I wonder how to use another backbone such as efficientnet. I tried switch resnet34 to other backbone, but the images look black. Thank you.

  • @sophiez7952
    @sophiez7952 2 года назад +1

    great viedo, please told me the scientific software that i can see the black tiff image, thanks again, this is the best i have ever watched!

    • @DigitalSreeni
      @DigitalSreeni  2 года назад

      You can use imageJ to view and process scientific images. imagej.net/software/fiji/

  • @AltafHussain-gk2xe
    @AltafHussain-gk2xe Год назад

    Thank you sir, your deep learning series is one of the best series so far. Sir please also make a video on pavement/road crack segmentation.

  • @sabrina-fn7wn
    @sabrina-fn7wn Год назад

    Thank you so much for making these videos, they really help me a lot!

  • @grannycola158
    @grannycola158 2 года назад

    Thank you, Dr. Sreeni!

  • @jayansrijeewantha
    @jayansrijeewantha 3 года назад

    Wow, thanks for making this video. I learned a lot and everything is clearly explained.

  • @tamersaleh8042
    @tamersaleh8042 3 года назад

    THANKS, I love your explanation very much.

  • @cutestanimalsofworld6698
    @cutestanimalsofworld6698 Год назад

    i have label my image mask in seven layer but when check the unique value in my numpy array it shows twelve value.I am confused why it happens.

  • @saanvitayal
    @saanvitayal 2 года назад

    Error: ( Unexpected result of `train_function` (Empty logs). Please use `Model.compile(..., run_eagerly=True)`, or `tf.config.run_functions_eagerly(True)` for more information of where went wrong, or file a issue/bug to `tf.keras`) How do we solve this?

  • @Jon-j5v
    @Jon-j5v 10 месяцев назад

    Thank you so much!
    Sir, can you help to solve the issue: IndexError: index 255 is out of bounds for axis 1 with size 2 ?
    My masks consist of 2 classes only.

  • @namdeobadhe5478
    @namdeobadhe5478 2 года назад

    when i train inceptionv3unet model on landcover dataset i am geeting very low mean IOU

  • @nikkg7055
    @nikkg7055 Год назад +1

    if the dataset only contains images in .tif but no mask for those corresponding images then how can we deal with it @DigitalSreeni
    please help me out in this..!

    • @kyosuke.t120
      @kyosuke.t120 5 месяцев назад

      Did you got an answer on that topic? I had the same question :/

    • @pratikmaral1985
      @pratikmaral1985 Месяц назад

      @@kyosuke.t120 did you get it

  • @SandipRijal-yi2qj
    @SandipRijal-yi2qj 9 месяцев назад

    UnidentifiedImageError: cannot identify image file I am getting this for my while using train generator for tif files after code x, y = next(train_img_gen).

  • @DinaAdel-lo5mb
    @DinaAdel-lo5mb 6 месяцев назад

    I don't have a GPU on my laptop so I am using kaggle and google colab but the training takes a long time to finish in addition to, there is no enough memory therfore it leads to restart the session. What should I have to do?

  • @RaghadAlamri-w1v
    @RaghadAlamri-w1v Год назад

    I have different image sizes in my dataset, 1024 , 1000, 900 and 650. I want to divide them into 512 patches, if I used your method lots of the info will be lost. how to patchily them with minimum overlap and without loosing much of the info, any idea ? and thank you for these videos !!

  • @talha_anwar
    @talha_anwar 3 года назад

    Thanks sir. If you don't mind using pytorch backend I would say check monai . Btw the concepts in your video is crystal clear.

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      Thanks for the suggestion. Unfortunately, monai uses pytorch as you noted.

  • @BEPROJECT-jg9db
    @BEPROJECT-jg9db Год назад

    I am getting this error when i run prediction on large satellite image
    Invalid shape (4697, 4127, 5) for image data

  • @hananebktr638
    @hananebktr638 8 месяцев назад

    Thanks for the video it is very helpful, I followed your plan but I divided the images into 512 patches and everything went well but when I trained the model only train for 2 epoches and then gets atributeerror : 'minmaxscaler' object has no attribute 'min _'
    Please help me solve this problem

  • @abdulbasit9429
    @abdulbasit9429 Год назад

    labels:
    0: Unlabeled background
    1: Buildings
    2: Woodlands
    3: Water
    n_classes=4
    is it possible only to segment buildings and background? (classes=2),

  • @huyenbui3160
    @huyenbui3160 7 месяцев назад

    Your video is really useful.
    Besides, while running, I met the error "TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type float64 of argument 'x'.". How can I solve this?

  • @aayushbhardwaj6347
    @aayushbhardwaj6347 2 года назад

    hi Sreeni. thank you for the amazing video. I just need a small help. I'm still struggling with the fix you mentioned at the end of the video. I'm still getting the error "ValueError: cannot reshape array of size 1793064960 into shape (76,72,256,256,4)". I request you to please explain it more deliberately.

  • @mahshanzaheer1457
    @mahshanzaheer1457 3 года назад +1

    Hi, there. I am thankful to you for making such an informative videos. In your videos you always have 01 ground truth image against 01 image file. I am working on "Brain Tumor Segmentation" problem whereby we have 01 ground truth file against 04 images. I have two question
    1. 01 image-01 ground truth case). Normally we specify 1 folder having set of image and 1 folder with set of ground truth files, how does network knows how to pick ground truth corresponding to an image?? I mean it can wrongly pick ground truth of some other image.
    2. 04 images-01 ground truth case) Can you please make a video and explain (with code) how can i make neural network pick 04 images and its relevant ground truth for their respective folders. Again I fear that if the model pick wrong ground truth, it can produce wrong results.
    Thanks

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      Please wait a couple more days for my video on segmenting Brats data set.

  • @ipangraphy4277
    @ipangraphy4277 2 года назад +1

    hai sir, i really happy on founding your video, but can i ask, what is the process need to be done if the dataset did not have the "mask" image/file? or do you have any video on how to do it? hopefully you can aswer my question. have a nice day sir :)

    • @kyosuke.t120
      @kyosuke.t120 5 месяцев назад

      Did you got an answer on that topic? I had the same question :/

  • @silpalatha5039
    @silpalatha5039 Год назад

    I am getting import error:dll load failed while importing cv2

  • @johnalderson7893
    @johnalderson7893 3 года назад

    Hi! Thank you so much for the video!! I am trying to use this code using my own data, but the model only predicts "black images". Does anyone know why? I would highly appreciate any comment.

  • @gajariaanand
    @gajariaanand Год назад

    Hello Sir @DigitalSreeni, I was trying to download the dataset from the mentioned source, however i was not able. I think they have removed the download link. Is it possible to for you to avail that data for us somehow?
    That would be a great help.
    Thank you!

  • @user-sp5yr3iy6q
    @user-sp5yr3iy6q Год назад

    I got this error when verifying the generator in training landcover keras augmentation
    categorical[np.arange(n), y] = 1
    IndexError: index 4 is out of bounds for axis 1 with size 4
    could you explain this? How do you think I could solve this error? I am not good enough in Python but I need to understand, thank you.

  • @alinebarrocamarra2449
    @alinebarrocamarra2449 Год назад

    Thanks for the amazing videos. I have a specific question: How could I deal with an image of a single area but with 15 bands (layers)? In this case, the mask would be only one. My problem is patching them and then reading them for training.

    • @DigitalSreeni
      @DigitalSreeni  Год назад +1

      An image with 15 bands is similar to an RGB image that has 3 bands (channels) - except in your case you will have 15 channels. You can patch them the same way you patch RGB images, except (again) you will define 15 channels instead of 3.

    • @alinebarrocamarra2449
      @alinebarrocamarra2449 Год назад

      @@DigitalSreeni But the U-net structure only accepts 3 channels, right?

  • @widiatmokoazis9424
    @widiatmokoazis9424 Год назад

    Hi! I'm currently working on a quite similar project but stuck while patching the images. Instead of having RGB tiff image, I have RGBA tiff image. When I tried using patchify i think it change the image into uint8 and messed the image and ended up not look like the original rgb representation. I wonder if there's any solution to this problem? I tried to split the image cannals to emit the alpha band but still fail up to now.
    Thanks!

  • @sophiez7952
    @sophiez7952 Год назад

    hi, thank, you generate a name called keras_aug file,the images number reduced from 16443 to 15056, why ? i cannot find your code!

  • @patrickjoseroxas1771
    @patrickjoseroxas1771 Год назад

    Hi, I tried recreating it in Colab but cv2.imwrite() is not saving the patched images & masks.

  • @agniveshpandey8692
    @agniveshpandey8692 2 года назад

    for this line of code x, y = train_img_gen.__next__() for this file
    /230_landcover_dataset_segmentation/training_landcover_keras_augmentation_V2.0.py i am getting the error TypeError: float() argument must be a string or a number, not 'TiffImageFile' please help

  • @JLeonSarmiento
    @JLeonSarmiento 3 года назад +1

    Thanks a lot, this is gold.

  • @ninansajeethphilip4656
    @ninansajeethphilip4656 2 года назад +1

    Good work!

  • @moisesdesouzafeitosa3364
    @moisesdesouzafeitosa3364 3 года назад

    thank you for this amazing content, sir.

  • @adnanebadaoui4033
    @adnanebadaoui4033 2 года назад

    hello training model on eoch take 15 hours for one epoch how can i fix it ??

  • @RaghadAlamri-w1v
    @RaghadAlamri-w1v Год назад

    I used the vanilla unet you implemented in a previous video, when I used batch size 16 a 100 epoch where run very fast with poor accuracy , I changed it to 1000 and got better result, would it get better result if I load the whole dataset and trained the model on it instead of a smaller batches ?

  • @monicaortegacastro3122
    @monicaortegacastro3122 2 года назад

    Thank you very much for the content. You make real problems easier and more accesible.
    I am struggling with the last part of the code, the prediction for a new input. The problem is related to the cuda.
    When i run the last part of the code it says:
    2022󈚩󈚷 20:34:05.287381: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance‑critical operations: AVX AVX2
    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
    2022󈚩󈚷 20:34:05.838147: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 4632 MB memory: ‑> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022󈚩󈚷 20:34:42.348787: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8400
    However, I followed the GPU for tensorflow installation steps on your video 217 ruclips.net/video/yLVFwAaFACk/видео.html

    The check messages appears to be correct (you can read it at the end). However, it says that the tensorflow is optimised for oneDNN instead of cuDNN. The tensorflow version is 2.9.0 and the python 3.9.
    I was looking for some solutions on the internet, one of them was to include the following code:
    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
    It doesn't work.
    I am new to the topic and honestly also a bit desperate. Could you please give me a hint on how to proceed or any idea of what is wrong with this?
    Thanks a lot
    2022-05-19 20:38:59.367245: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
    2022-05-19 20:38:59.964067: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022-05-19 20:38:59.969320: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022-05-19 20:40:39.673713: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022-05-19 20:40:39.674187: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022-05-19 20:41:08.690288: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1
    2022-05-19 20:42:34.174840: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 4632 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1

  • @tankformations1048
    @tankformations1048 Год назад

    Hello, i appreciate your tuto, very helpful. Can I help me with Opensource material to annotating sentinel-2 images? Or GeoTiff...........

  • @georgemiller6010
    @georgemiller6010 3 года назад

    Hey great stuff. Every video ends on predictions, but could you do a short video on how to apply IoU scores to the predictions (images not in the test/train datasets) in a binary case to test how well the model is performing? If you've already done this, could you point me in the right direction? Thanks

    • @basilelongo8374
      @basilelongo8374 3 года назад

      Hey, I found this in one of his video don't renember which one :
      #IoU for a single image
      n_classes = 2
      IOU_keras = MeanIoU(num_classes=n_classes)
      IOU_keras.update_state(y_true, y_pred)
      print("Mean IoU =", IOU_keras.result().numpy())
      you can then use it in a loop to test the model performance I guess : )

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      I am not sure what you mean by applying IoU scores to predictions. To calculate IoU, you need ground truth and predictions. IoU is a metric that reflects the quality of our predictions. I have used IoU for binary classes, if that is your question.

  • @wonderwithaiml
    @wonderwithaiml 2 месяца назад

    I see the data used in this tutorial has been moved, the data link provided doesnt work . Can you help me with that?

  • @sahandn8083
    @sahandn8083 3 года назад

    Thanks for the good tutorials and one question, how can we use multiple masks? In satellite images, there are indicators that these indicators mean together, such as ndvi, tci, etc.

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      I am not sure what you mean by multiple masks. An image has a single ground truth so you work with single mask that contains information about a pixel. For example, a pixel or a collection of pixels correspond to a building or a tree or a road, etc. You can have multiple labels for a given pixel in which case the problem becomes multiclass multilabel semantic segmentation.

  • @mustajabhussain9167
    @mustajabhussain9167 2 года назад

    I have a question. Can you please reply to that.
    We have 4 labels in masks. The unlabeled class(class 0), I have question regarding it. Do we need to remove that class 0 pixels from our training dataset because it is lowering the accuracy of the model. I am working on semantic segmentation related problem. I think my model is not predicting well due to the presence of unlabeled class (class 0). Removing/replacing that can increase the performance. What do you think. Am I going in right direction

  • @8507Lisa
    @8507Lisa Год назад

    Can I make a tutorial request regarding Google Earth Engine? As I start using satellite images in my study recently, found GEE is probabaly the way to go considering that I have limite storage and computing power with my PC. Thank you! Learnt a lot from you since I found your channel half a year ago :)

  • @jaiswalfelipe1269
    @jaiswalfelipe1269 2 года назад

    can you use patchify for 23 band images?

  • @AjinkyaBobadepictpune
    @AjinkyaBobadepictpune 6 месяцев назад

    Strangly I get this error after training 4 epochs :
    unknown: attributeerror: 'minmaxscaler' object has no attribute 'min_' traceback

    • @AjinkyaBobadepictpune
      @AjinkyaBobadepictpune 6 месяцев назад

      @DigitalShreeni is there anyway you can help me out in this

  • @ramiroalvitediaz3910
    @ramiroalvitediaz3910 2 года назад

    First of all, thank you for your amazing job.
    I think that in landcover_prepare_data.py line 170 "counts[0]" fetches the counts of the first value in vals. In the case of patches with no background , the first useful value in vals will be considered as background. If only one valid class is present in the patch the code will interpret as useless image.
    Kind regards.

  • @zaidilyas5192
    @zaidilyas5192 3 года назад

    Thank you for making tough things so much easy. You are doing a great job! I want some guidance in Semantic Segmentation Case. How can I approach you?

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      Unfortunately, I do not have time to help out on personal projects. I wish I had that kind of time.

    • @zaidilyas5192
      @zaidilyas5192 3 года назад

      @@DigitalSreeni ok. No issues.

  • @imranrajjad7028
    @imranrajjad7028 2 года назад

    Question : Can we use this example to only detect a single class? Given the masks are modified to only work for one type of land feature (e.g water). What kind of modifications will be required?

    • @johnnysmith6876
      @johnnysmith6876 2 года назад

      I’ve done this. If you need help, let me know.

    • @mdabuzafor4636
      @mdabuzafor4636 2 года назад

      @@johnnysmith6876 please share the code

  • @fahadabdullah510
    @fahadabdullah510 Год назад

    I want to use this model for flood mapping so can anybody tell what will be the no of classes for me in this case 1 or 2?

  • @sophiez7952
    @sophiez7952 Год назад

    it often has errors!hi, thanks, i have a problem when apply your code, the error is cannot import name 'get_source_inputs' from 'keras.engine' (C:\Python39\lib\site-packages\keras\engine\__init__.py), i want to know how can i solve it?

    • @DigitalSreeni
      @DigitalSreeni  Год назад

      Where ever you see keras.something in the code, change it to tensorflow.keras.something
      I hope that fixes the issue.

  • @falahfakhri2729
    @falahfakhri2729 3 года назад

    You're amazing as always, thanks a lot for your hard efforts,
    Did you share this 230- the code?, I didn't find it!
    In some researches they use cutting images into tiles, Is this similar to patching?
    How could we know the patch size 256, or 255, is the best without creating gap?
    Is converting to categorical necessary for multi-class only, Or for both multi-class and one class for instance building footprint?

    • @DigitalSreeni
      @DigitalSreeni  3 года назад +1

      The code is available on my github page.
      Cutting images to tiles is same as dividing images into patches.
      You need to do the math about the right shape for your patches / tiles based on the input image. I divide my images into tiles of size divisible by 2**n (32, 64, 128, 256, 512, etc.).
      Converting to categorical is necessary for multiclass if you plan on using cross entropy based loss functions that expect categorical inputs (categorical cross entropy, focal loss, etc.).

    • @falahfakhri2729
      @falahfakhri2729 3 года назад

      @@DigitalSreeni I really thankful to you, actually you're doing great by simplifying difficult things into very handy. Do you mean for building footprint extraction when the mask is only has one class categorical is needed? Hope you have time for building footprint extraction to be next video .

  • @ankitmohanty6436
    @ankitmohanty6436 2 года назад

    hi if you could provide the link to your weights that would be very helpful thanks

  • @harrishvar7677
    @harrishvar7677 8 месяцев назад

    what changes should i have to make if my masks are color images and have 7 classes

    • @g111an
      @g111an 8 месяцев назад

      Mask needs to be a single band input. Maybe convert to grayscale and check unique values and map them to your classes

  • @haniehh2160
    @haniehh2160 2 года назад

    How can I adapt this to binary masks? I mean what if my masks are binary?

  • @jejekerja5761
    @jejekerja5761 Год назад

    This is the second I asked, is it possible to discuss this via email or chat Mr?

  • @BEPROJECT-jg9db
    @BEPROJECT-jg9db Год назад

    I am getting this error when i run prediction on large satellite image
    Invalid shape (4697, 4127, 5) for image data can u resolve this error

    • @mrjigeeshu
      @mrjigeeshu Год назад

      I am getting the same error. Were you able to solve this?

  • @amanjain6680
    @amanjain6680 3 года назад

    Omg! This is too good ❤️

  • @prathameshjoshi1408
    @prathameshjoshi1408 3 года назад

    Can we use Pix2pix to produces masks as doing an image to image translation and then combining the images will that do it ?? Please tell me if the approach I think is wrong !!

    • @DigitalSreeni
      @DigitalSreeni  3 года назад +1

      Pix2pix is a valid approach for semantic segmentation but not efficient compared to U-net.

  • @hamidyusuf4950
    @hamidyusuf4950 2 года назад

    thanks Sreeni. I got lot of knowledge bout semantic segmentation. But i have a question, How to implement the method with video input? do you have example code? thanks

    • @DigitalSreeni
      @DigitalSreeni  2 года назад

      Nothing tricky with videos. Videos are just a sequence of images, so if you manage read them into python, you can perform semantic segmentation.

    • @hamidyusuf4950
      @hamidyusuf4950 2 года назад

      @@DigitalSreeni oh okey Sir, thank you.

  • @ranamobeen3500
    @ranamobeen3500 2 года назад

    I didn't show the output folder while writing new images within the subdirectory. The code is executing but no output is shown in the output location. The code is:
    cv2.imerite(root_directory+"256_patches/images/"+image_name+""pattch_+str(i)+str(j)+".tif", single_patch_img) The error shown:
    False
    Could you please let me know whats the problem?

  • @sandeeprenati9905
    @sandeeprenati9905 Год назад

    Sir I got inspired from your video and selected this as my final year project sir but , I am unable to execute it in Google colab , can you help me with the part of diving and saving it in drive .....

    • @DigitalSreeni
      @DigitalSreeni  Год назад

      Use a subset of images or small images or small batches.

  • @taiwosoewu5759
    @taiwosoewu5759 2 года назад

    Hi Dr. Sreeni, I was following your image segmentation tutorials and i discovered that most of the datasets you were using already contain masks. I want to detect and segment tumors from MRI images of brain but the datasets I am using doesn't contain masks. How do I go about it? Is it compulsory to have masks available before performing segmentation?
    I hope you see and answer this comment as soon as possible.
    Thanks.

    • @DigitalSreeni
      @DigitalSreeni  2 года назад +1

      Please check my labeling videos, for example this one:
      Labeling images for semantic segmentation using Label Studio
      ruclips.net/video/UUP_omOSKuc/видео.html

    • @taiwosoewu5759
      @taiwosoewu5759 2 года назад

      @@DigitalSreeni Thank you very much sir.

  • @debarunchakraborty3798
    @debarunchakraborty3798 2 года назад

    Hi, sir i loved your video on semantic segmentation of landcover dataset. First of all thank u a lot for making this video. Sir i have been trying to implement the same on my system but encounter with an bug in the training section. I have tried with both the dataset version 0, as well as version 1, but getting an index error.
    IndexError: index 4 is out of bounds for axis 1 with size 4
    Sir it will be a great help if you could guide me how to debug it.
    Thank and regard
    Debarun Chakraborty

    • @syalwadea
      @syalwadea 2 года назад

      i get some error like that, so can you give the solution? thank you

  • @ninjahattori1397
    @ninjahattori1397 3 года назад

    Can u explain what is use of this project???

  • @VinodKumar-xc9kx
    @VinodKumar-xc9kx 3 года назад

    Really appreciate your work. Thank you. Please keep it coming.
    I am working on a multiclass segmentation problem. In addition to the segmentation map for each of the objects, I also need a severity score of this detected object. This is like a multi task network which outputs segmentation maps and scores for each of the detected objects. If I have another smaller decoder that outputs a vector, the size of the vector would have to vary based on the number of objects detected.
    I just can't find any ideas on how to architecture could be. I would grateful for any advice.

  • @irfanbhaswara6813
    @irfanbhaswara6813 2 года назад

    Thank you Dr. Sreeni for your tutorial. However I have a question related to the labeling. Do we need to define the label color of the classes first as shown in your previous video or not? Since in this video, you didn't define the label color

  • @vlls.brn.38
    @vlls.brn.38 Год назад

    Can anyone tell me if it is normal that training for each Epoch takes approximately 2 hours?

  • @abdhafizakaria
    @abdhafizakaria 3 года назад

    Hi,this is very interesting video.However,I have try run the training_landcover_keras_augmentation_V2.0.py but this error happen. Can I know how to solve it?
    Error:
    ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

    • @DigitalSreeni
      @DigitalSreeni  3 года назад +1

      This error has nothing to do with this python code. It appears to be your network issue, please verify.

    • @abdhafizakaria
      @abdhafizakaria 3 года назад

      Yes it is fue to my network issue.Still figure it out to solved the error.Thank you Dr.

  • @sophiez7952
    @sophiez7952 Год назад

    i cannot install segmentation-models?

  • @dhirojkumarbehera1089
    @dhirojkumarbehera1089 2 года назад

    please help me with the below error Dr. .
    Thank you in Advance.
    Please solve my issue. (I am using python 3.10)
    While i am running the image generator part of :- x, y = train_img_gen.__next__()
    ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by MinMaxScaler.

    • @DigitalSreeni
      @DigitalSreeni  2 года назад

      Did you Google search for the error? Here is a link you may find useful: stackoverflow.com/questions/53421626/valueerror-found-array-with-0-sample-s-shape-0-1-while-a-minimum-of-1-is

    • @dhirojkumarbehera1089
      @dhirojkumarbehera1089 2 года назад

      While i am running the image generator part of :- x, y = train_img_gen.__next__()
      Found 16434 images belonging to 1 classes.
      Found 16434 images belonging to 1 classes.
      ---------------------------------------------------------------------------
      TypeError Traceback (most recent call last)
      in
      ----> 1 x, y = train_img_gen.__next__()
      4 frames
      /usr/local/lib/python3.7/dist-packages/keras/utils/image_utils.py in img_to_array(img, data_format, dtype)
      298 # or (channel, height, width)
      299 # but original PIL image has format (width, height, channel)
      --> 300 x = np.asarray(img, dtype=dtype)
      301 if len(x.shape) == 3:
      302 if data_format == 'channels_first':
      TypeError: float() argument must be a string or a number, not 'TiffImageFile'

    • @himanshuchaubey5284
      @himanshuchaubey5284 Год назад

      Hey, were you able to resolve the error? I am facing the same issue.

    • @pavanisuresh2585
      @pavanisuresh2585 3 месяца назад

      I had the same error. Organizing the folders into subfolders as shown in first half of video helped my resolve this error. Hope this helps!

  • @sophiez7952
    @sophiez7952 Год назад

    why my categories of landcover ai is 5 categories, while your categories are 4 ? i feel curiosity!

  • @niinaaaalami9763
    @niinaaaalami9763 Год назад

    I did exactly what you say, but document doesn't creation

  • @staticrevo
    @staticrevo 3 месяца назад

    What dataset are you using please

  • @RehanKhan-nw7vs
    @RehanKhan-nw7vs 11 месяцев назад

    where to get this mask data?

  • @web9599
    @web9599 2 года назад

    what about error index out of range

    • @nittinmurthi6300
      @nittinmurthi6300 2 года назад

      I have the same issue. I don’t know how to solve it

  • @pallavi.munihanumaiah7786
    @pallavi.munihanumaiah7786 3 года назад

    Thank you sir

  • @science3605
    @science3605 2 года назад

    Thank you so much sir for this great video ,,,
    Sir I got a error and I could not fix it from last few days ,
    when I try to verify generator I by "x, y = train_img_gen.__next__()" by this line of code
    I got this error ""*IndexError: index 4 is out of bounds for axis 1 with size 4*"

    • @불루이보스
      @불루이보스 2 года назад

      i have same error.. "
      IndexError: index 100 is out of bounds for axis 1 with size 9"

    • @saanvitayal
      @saanvitayal 2 года назад

      Hey! I was facing the same error few days ago. print("Labels in the mask are : ", np.unique(mask_dataset)) to find the classes in your dataset. In his dataset, the total classes/labels are 4 but in ur dataset they are more

    • @goureeshyarlagadda5031
      @goureeshyarlagadda5031 2 года назад

      I was facing the same error, I came across that I was using Lancover Dataset Version 1 they use 5 classes including "roads" so it will work with Version 0 as it has a total of 4 classes

    • @souvikdatta5686
      @souvikdatta5686 2 года назад

      For anyone who still might be struggling with "IndexError: index 4 is out of bounds for axis 1 with size 4"
      Change the num_classes in the Original Code from 4 to 5 ----->
      Original Code Snippet: train_img_gen = trainGenerator(train_img_path, train_mask_path, num_class=4)
      val_img_gen = trainGenerator(val_img_path, val_mask_path, num_class=4)
      New Code Snippet: train_img_gen = trainGenerator(train_img_path, train_mask_path, num_class=5)
      val_img_gen = trainGenerator(val_img_path, val_mask_path, num_class=5)

  • @SohelRana-tm9xg
    @SohelRana-tm9xg 2 года назад

    I can't access landcover.ai?
    Sir, please open dataset for download

    • @DigitalSreeni
      @DigitalSreeni  2 года назад

      This is not my data set. I found some data on landcover when I recorded this video and for some reason that web page doesn't exist anymore. But the process I showed should work for any dataset and I am sure you can find some good ones on kaggle.

  • @muhakmalulimanl9103
    @muhakmalulimanl9103 2 года назад

    Why i can;t access landcover.ai?

  • @lucaslanglois5157
    @lucaslanglois5157 2 года назад

    Great work and awesome tutorial. I was able to replicate this on my own data no problem. However using the prediction smooth function seems to be limited to fairly small images. I tried to run it on a 4GB drone orthomosaic and it crashed due to lack of RAM. Is there a simple way to optimize that function so that it is able to handle much larger input images ?

  • @PraySurvey
    @PraySurvey 3 года назад

    Thank you so much

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      You're most welcome

    • @PraySurvey
      @PraySurvey 3 года назад

      @@DigitalSreeni While I run your code, the generator didn't work correctly and gave me this error message "ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by MinMaxScaler."
      What can I do to solve this?

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      Please make sure you are reading the data correctly, may be the path is wrong or you have a specific path but you are not working in the right directory. In any case, it looks like there are no samples (images) for minmax scaler.

    • @himanshuchaubey5284
      @himanshuchaubey5284 Год назад

      @@PraySurvey Hey, were you able to resolve the error? I am facing the same issue.

  • @sayantanbhowmik4196
    @sayantanbhowmik4196 3 года назад

    sir kindly upload the code in github

    • @DigitalSreeni
      @DigitalSreeni  3 года назад

      It has been uploaded: github.com/bnsreenu/python_for_microscopists/tree/master/230_landcover_dataset_segmentation

  • @AbdullahJirjees
    @AbdullahJirjees Год назад

    Thanks for the video, my image is 6 bands can I use your code on it? as when I start testing it I go this error
    imread_('data/image/image.tif'): can't read header: OpenCV(4.8.1) /io/opencv/modules/imgcodecs/src/grfmt_tiff.cpp:155: error: (-2:Unspecified error) in function 'int cv::TiffDecoder::normalizeChannelsNumber(int) const'
    > Unsupported number of channels:
    > 'channels >= 1 && channels

  • @tgbspark9346
    @tgbspark9346 3 года назад +1

    What is the usage of this......?

  • @namdeobadhe5478
    @namdeobadhe5478 2 года назад

    when i train inceptionv3unet model on landcover dataset i am geeting very low mean IOU

  • @puranjitsingh1782
    @puranjitsingh1782 2 года назад

    Thanks!

    • @puranjitsingh1782
      @puranjitsingh1782 2 года назад

      I had a question. I am training Unet on my custom dataset. I can use the data augmentation techniques as you have suggested. How much is the increase in the number of images during the training phase using augmentation? There are 7500 images in my training dataset after train_test_split.

    • @DigitalSreeni
      @DigitalSreeni  2 года назад +1

      Sata srī akāla Puranjit paaji. Tuhāḍā dhanavāda for the kind contribution.
      Augmentation performs various image processing operations so that the same data can be presented in many different ways for the algorithm to generalize a bit more. It will not increase your accuracy, it will make it more generalized. In terms of by how much the data will increase, it depends on your number of steps per epoch. It keeps on generating data based on the steps per epoch. I recommend using steps per epoch as your total images divided by your batch size. For example if you batch size is 16 then steps per epoch would be 7500/15 (in your case). This presents all your 7500 images, transformed (augmented) about 468 times per epoch.

    • @puranjitsingh1782
      @puranjitsingh1782 2 года назад +1

      @@DigitalSreeni Sat sri akal sir,
      Thank you so much for your detailed explanation on my doubt. Your videos are helping me a lot in my research work. Really appreciate that!!