Gathering Images for Haar Cascade - OpenCV with Python for Image and Video Analysis 18

preview_player
Показать описание
In this tutorial with Python and OpenCV, we continue to learn how to create our own Haar Cascades for object detection. We make use of image-net to gather relevant images.

Рекомендации по теме
Комментарии
Автор

it's a shame your videos have so few views. you have a gift for teaching and explaining things in an intuitive way, and i bet a lot of people could benefit from all this content you have produced.

diracleo
Автор

been a follower of Sentdex for nearly 2 years. This guy is a hardworking honest youtuber. He has introduced me to ML and most of the knowledge I have about python is thanks to him. he asks for nothing in return but we have to be show gratefulness by liking and sharing his content for the benefit of all. Thank you sentdex you mean a lot to us.

zakariaabderrahmanesadelao
Автор

Awesome tutorials. Thank you so much. Dumb update but if anyone is trying to copy the code from the website, don't forget to call the function 'store_raw_images()' at the end.

justchill
Автор

Your way to explain is awesome, we feel that you want to share knowledge BECAUSE we have it at the end, in a good manner

allolola
Автор

This is really helping buddy, keep it up.
Those, using python 2.7. Just
import urllib and remove request from
urllib.request.urlopen . (remove request) just write urllib.urlopen
urllib.request.urlretrieve (remove request) urllib.urlretrieve

muhammadabraranwar
Автор

Very neat method for retrieving images!

neocephalon
Автор

Thanks to your video I have successfully done the task!!

sugandichow
Автор

amazing video as always

if anyone struggling with urllib.request.urlretrieve hanging

I replaced
urllib.request.urlretrieve(i, "neg/"+str(pic_num)+".jpg")


with
f = open("neg/"+str(pic_num)+".jpg", 'wb')
f.write(urllib.request.urlopen(i, timeout=5).read())
f.close()

asha
Автор

I would like to thank you for your nice tuto..
I'm french but i understand by making an effort !
keep going !

techwithimad
Автор

Thank you, you make learning easy.
Keep doing what you do best :)

christaylor
Автор

imagenet links not working anymore after they updated the site, are there any other alternatives to grab thousands of negative images efficiently?

tengkianen
Автор

could you please tell how is it done for python 2.7?
i've a lot of methods but none of them is working

ujwalkaka
Автор

Get "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte" error in " neg_img_url = " help

arvindvish
Автор

Hi!
I saw your this tutorial and its really awesome. The problem is that image-net.org is down since few months. Can you suggest its alternative so that the code may work

adeelzaidi
Автор

Great tutorial. I've been watching your image processing with openCV tutorials and I'd just want to say they are far superb than other tutorials online.
I'd just want to improve your code a little bit so you can read multiple url links and save all the images all at once instead of replacing the link once the first grab link is completed.

#!/usr/bin/python3

import urllib.request
import cv2
import numpy as np
import os

def store_raw_images():
neg_images_links = ['linkA', 'linkB', 'linkC']
for link in neg_images_links:
neg_image_urls =
pic_num = len(os.listdir('neg/'))+1

if not os.path.exists('neg'):
os.makedirs('neg')
for i in neg_image_urls.split('\n'):
try:
print(i)
urllib.request.urlretrieve(i, "neg/"+str(pic_num)+".jpg")
img = cv2.imread("neg/"+str(pic_num)+".jpg", cv2.IMREAD_GRAYSCALE)
#~ should be larger than samples / pos pic (so we can place our image on it)
resized_image = cv2.resize(img, (300, 300))
cv2.imwrite("neg/"+str(pic_num)+".jpg", resized_image)
pic_num += 1
except Exception as e:
print(str(e))

if __name__ == '__main__':
store_raw_images()

hang
Автор

Some of my images are getting converted to grayscale and to 100 x 100 and many are not.
What could be the issue?

arshitchabukswar
Автор

Image-net does not respond or respond very slowly... result:
"urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>"

Paavo
Автор

How can I access multiple images and do face recognjtion of each image?

ashutoshsatapathy
Автор

What should be put inside decode?
If I put decode(), it gives an error. So i tried to do some research and wrote decode('utf-8').
But it works very slow. It took almost 2 hours for downloading ~160 images. NEED HELP!!!

shantanughosh
Автор

Aren't we Saving images twice (one while URL retrieving and other time with cv2.imwrite ) ?

saikrishna