Image Augmentation (Improve your Dataset) | with Imgaug, Opencv and Python

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

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

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

    thank you, your explanation is easy to understand

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

    That is great, I have a question but how to do augmentation to labeled images in yolo format

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

    Awesome video but... i was expecting to show how to save the augmented images locally to the PC!

  • @RaviKumar-rf6qq
    @RaviKumar-rf6qq 2 года назад

    Dear Mr Sergio Canu
    Many thanks for your valuable information.
    Kindly give the code to save the augmented images into a folder.
    Thanks for your kind understanding and support.

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

    How can you move the bounding box along with the image rotation?

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

    Thanks much. Is there a way to detect side angle without eyes

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

    Hi, can you let me know how to save a video to my desktop using opencv

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

    Fantastic tutorial, thanks a lot man !

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

    How can I save those generated images?

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

    Hello, How can i place all augmented images into new folder?
    Thank you

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

    how to save the image after augmentation? thanks

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

    I tried using imWrite instead of imshow as an attempt to save my files locally. However, each image being saved is overlapped by the next one. How can I save all of the photos altogether without them overlapping each other?

    • @pysource-com
      @pysource-com  3 года назад

      you need to save them with a different title.
      you can add a counter variable outside the loop and increase it by one on each loop:
      counter = 0
      while True:
      counter += 1
      cv2.imwrite(str(counter) + ".jpg", frame)

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

      @@pysource-com is this correct? please correct me if im wrong
      #dataset and augmentation code
      counter = 0
      while True:
      augmented_images = augmentation(images=images)
      for img in augmented_images:
      counter += 1
      cv2.imwrite(str(counter) + ".jpg", frame)
      cv2.imwrite('Desktop/WartyAugmented/warty.png' ,img) #desired save location
      cv2.waitKey(0)
      also if this works, how do i limit the number of images that the augmentation will generate? thank you in advance

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

      @@johnalfredcastaneda1596 Hi, did you solve this problem?

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

      @@johnalfredcastaneda1596 use for loop instead of while loop....
      augmentation_counter = 0 # the current loop of augmentation indicator
      for i in range(10): # desired amount of times you need to augment
      augmented_images = augmentation(images = images)
      counter = 0 # counter representing the index that distinguishes the 3 dogs
      for img in augmented_images:
      cv2.imshow("Image", img)
      cv2.imwrite(f'Data\augmented\{name_list[counter]}{augmentation_counter}.jpeg', img)
      cv2.waitKey(0)
      counter += 1
      augmentation_counter += 1

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

      cv2.imwrite(os.path.join(augment_path, f'{name_list[counter]}'+ '_' + f'{augmentation_counter}.jpeg'), img) #use this actually no the imwrite code in previous comment

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

    Sir this was very helpful thanks. Have liked and subscribed

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

    Hey great video! Is there anyway to apply this to images as well as the .txt files containing the bounding box coordinates?(asking this in reference to object detection)

    • @pysource-com
      @pysource-com  3 года назад

      Yes, when this library is integrated with the deep learning framework (for example keras or pytorch), it also applies the augmentation to the annotations.
      see more info on the official github release: github.com/aleju/imgaug

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

      @@pysource-com Oh great thanks for your reply

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

    Thanks for awesome tutorials, can you show us how to stream a video from opencv to rtsp?

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

    How can save generate image ?

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

    Hello,
    I am working with multi classification task. I have 3 folders. One of classes has few images and I want to increase that folder. My question is how can i augment that folder 10 times and save it at the same folder?
    Thank you

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

      use open cv to write images and save it to any folder u want

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

    nice and to save them on a local drive?

    • @pysource-com
      @pysource-com  3 года назад +2

      normally this is integrated with the deep learning framework, so you shouldn't save them, especially because they have annotations associated, which will also match the augmentation.

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

    great tutorial! but can you finally answer those questions in comments? ;__; please that would be really helpful as well

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

    Make please a video about Face_recognition

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

    thank you very much

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

    yo can anyone tell me how to actually store those augmented imgs as .jpeg

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

      import imgaug.augmenters as iaa
      import cv2
      import os
      import glob
      images = []
      images_path = glob.glob('Data\known\*.jpeg')
      for img_path in images_path:
      img = cv2.imread(img_path)
      images.append(img)
      augmentation = iaa.Sequential([
      iaa.Rotate((-30,30)),
      iaa.Fliplr(0.5),
      iaa.Flipud(0.5),
      iaa.Affine(translate_percent={"x": (-0.2,-0.2), "y": (-0.2,-0.2)},
      rotate=(-30,30),
      scale=(0.5, 1.5)
      ),
      iaa.Multiply((0.8, 1.2)),
      iaa.LinearContrast((0.6, 1.4)),
      iaa.Sometimes(0.5,
      iaa.GaussianBlur((0.0, 3.0))
      )

      ])
      train_path = 'Data/known' #training images path
      augment_path = 'Data/augmented' #augmented images path
      name_list = [] #collection of names
      myList = os.listdir(train_path) #list full name of all image file
      # test_path = 'Data\unknown' #test images path-
      live_path = 'Data/live' #live images path
      # make array of training images and corresponding person name
      for person in myList:
      name_list.append(os.path.splitext(person)[0])
      augmentation_counter = 0
      for i in range(1):
      augmented_images = augmentation(images = images)
      counter = 0
      for img in augmented_images:
      cv2.imshow("Image", img)
      cv2.imwrite(os.path.join(augment_path, f'{name_list[counter]}'+ '_' + f'{augmentation_counter}.jpeg'), img)
      cv2.waitKey(0)
      counter += 1
      augmentation_counter += 1