173 - Intersection over Union (IoU) for semantic segmentation

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

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

  • @deeplearningexplained
    @deeplearningexplained 4 месяца назад

    Love the energy, really sharp Sreeni.

  • @samarafroz9852
    @samarafroz9852 4 года назад +4

    Best tutorial sir. I just love your efforts. You're such a great personality.

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

    Salvou meu mestrado paizão, valeu demais!

  • @mrityunjaykumar2893
    @mrityunjaykumar2893 4 года назад

    i like your videos for crisp and clear delivery

  • @AhmedEmamAI1
    @AhmedEmamAI1 4 года назад +2

    Great video, thanks for the effort and the high quality material

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

    I think it is important to highlight that Keras is calculating the IoU macro-average. That is, the average IoU of all classes. You can also use the micro-average IoU, which is the sum of the intersections of each class divided by the sum of the unions of all classes. The choice of micro or macro should be made according to the imbalance of the dataset.

  • @hakunamatata-qu7ft
    @hakunamatata-qu7ft 4 года назад

    Good work Srini
    Thanks for teaching new concepts

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

    IOU_keras.update_state(val_y, y_pred_val)
    does this work for batch inputs. I tried, but gives only first 2 class pixel count in the confusion matrix variable

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

    For IOU_keras.results(), how did we really calculate the mean of the IOU values?

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

    Anyone please tell me how can we ignore background class in IOU calculation. Thanks

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

    Love it. Wonderful teaching.

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

    HEY can you share code for finding jaccard coefficient for multi class semantic segmentation Unet please

  • @nying3452
    @nying3452 4 года назад

    your very excellent professor. I love your lecture

  • @العالممنحولك-ص8س
    @العالممنحولك-ص8س 3 года назад

    Thank you very much and these are very valuable information. Thank you so much...

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

    I'm realizing a semantic segmentation task, and I want to compute the mIoU over a dataset. My doubt is, should I compute the mIoU of each image and average the results in the end, or should I build a giant confusion matrix of all image results and compute the mIoU from there?

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

    Thanks for the useful video, but I have confusion when implement MeanIOU into my Unet Semantic Segmentation ( not multiple class). Can you help me, please ?

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

    thank you for the videos sir

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

    Sir, I have a pair of ground truth and predicted images, but I don't have the model. is it possible to use just the images to find miou?

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

    Hello can you please make video on segmentation evaluation metrics like precision recall and ap, map. Thank you

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

    These codes will work in colab or not sir please reply sir

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

      All my code should work in any python IDE, including Colab.

  • @kishanjoshi5493
    @kishanjoshi5493 4 года назад

    Awesome tutorial...Thanks...

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

    Thanks for the great video! I am just wondering how do you produce the ground truth images? Thank you.

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

      Hi you need to label your dataset using some tool which could give your labelled images (ground truths)

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

      You either label the ground truth yourself with a tool or they are given with the dataset you're using.

  • @abderrahmaneherbadji5478
    @abderrahmaneherbadji5478 4 года назад

    Many thanks.

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

    Nice tutorial. I just find 1 mistake in the class2_IOU calculations. In the false positive you have added values[2,1] twice and skip the values[2,4]. Correct me if I am wrong.

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

      You are probably right, I will have to go back and check. I do not write unit tests for the code I generate for videos, this means I will make mistakes that can be hard to catch. I will correct the code on GitHub if there is a mistake. Thanks for reporting.

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

      @@DigitalSreeni thanks sir for reply. One question please. It is shown the miou calculation of background class is zero as it is ignored in miou calculation. Will you please tell me how can we ignore the background in iou calculation?

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

      Background class is part of the prediction process so it needs to be included as part of your IoU. If you only want to look at other real classes. For example, with keras' MeanIOU, you can print IoU for all classes individually, almost like a confusion matrix. You can just take the values for real classes and ignore the background.

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

    Whay don’t use kappa?

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

      May be this is why...
      journals.plos.org/plosone/article?id=10.1371/journal.pone.0222916

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

      @@DigitalSreeni Very good. Thanks. Do you know how Keras calculate the MeanIOU? just (sum/n?)

  • @fatemaahmed499
    @fatemaahmed499 4 года назад

    It will be a great help if you show how to calculate the mean iou using tensorflow2. I have faced problem while using tf.keras.MeanIoU()

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

    Sir, please make video on Metrics for evaluating 3D medical image segmentation like
    Dice Coefficient
    Jaccard Coefficient
    Area under ROC Curve (one system state)
    Cohen Kappa
    Volumetric Similarity Coefficient
    Hausdorff Distance (optionally in voxel or millimeter)
    Average Hausdorff Distance (optionally in voxel or millimeter)
    Balanced Average Hausdorff Distance
    Mahanabolis Distance
    Global Consistency Error
    Coefficient of Variation
    Probabilistic Distance
    and also Classic measures

  • @lalitsingh5150
    @lalitsingh5150 4 года назад

    Thanks for another great video. Sir I want to contact you

  • @HadiGhaderian-x8f
    @HadiGhaderian-x8f Год назад

    sombody can help me
    import cv2
    import numpy as np
    def vegetation_segmentation(image):
    # Normalize the image to the range [0, 1]
    image_norm = image.astype(np.float32) / 255.0
    # Calculate the individual color channels
    R = image_norm[:, :, 2]
    G = image_norm[:, :, 1]
    B = image_norm[:, :, 0]
    # Perform the necessary calculations
    R_prime = R * 255
    G_prime = G * 255
    B_prime = B * 255
    M = np.max([R_prime, G_prime, B_prime], axis=0)
    m = np.min([R_prime, G_prime, B_prime], axis=0)
    C = M - m
    H = np.zeros_like(R_prime)
    S = np.zeros_like(R_prime)
    V = M
    # Calculate H, S, and V values
    idx = np.where(C != 0)
    H[idx] = np.where(M == R_prime, 60 * ((G_prime - B_prime) / C % 6),
    np.where(M == G_prime, 60 * ((B_prime - R_prime) / C + 2),
    60 * ((R_prime - G_prime) / C + 4)))
    S[idx] = C[idx] / M[idx]
    # Perform thresholding to create a binary mask
    binary_mask = np.zeros_like(R_prime)
    binary_mask[np.where((H >= 60) & (H = 0.25))] = 1
    return binary_mask
    # Load the image
    image = cv2.imread("path/to/image.jpg")
    # Perform vegetation segmentation
    binary_mask = vegetation_segmentation(image)
    # Save the binary mask as a TIFF image
    cv2.imwrite("path/to/output_mask.tif", binary_mask.astype('uint8') * 255)
    # Display or further process the segmentation results as needed

  • @gurdeepsinghbhatia2875
    @gurdeepsinghbhatia2875 4 года назад +1

    A1