Hi everyone,
I have just learned about computer vision. Currently, i am processing a problem about image classification. I used HoG to extract features from images, but it takes a very long time whenever i run it. Is there anyway to reduce the time run it because my dataset is very large (about 15k images). And HoG extracts an image into a (1, 16740) vector dimension.
Here is the code i uses to extract features:
I am very thankful that you guys read my question, and i hope i can receive an answer soon.
Regard.
Edited:
This is the code which i use to load images:
def loadDataset(imgPath, dataf, features_extraction):
x = []
y = []
sto = dataf.reset_index(drop=True)
for i in range(len(sto)):
img_path = os.path.join(imgPath, sto['image'][i])
x.append(features_extraction(img_path))
y.append(dataf['label'][i])
x = np.array(x)
y = np.array(y)
return x, y
please find out how much time each line in your code takes. sum up the individual times per line across the entire dataset. use time.perf_counter(), or use a proper profiler
So that looks like… twenty nine seconds (29 s) to merely read the image, and another 0.3 secs for the actual processing, the majority of which is the hog() call.
now I don’t know how hog is defined. you didn’t show that code. for all I know, it’s not even from OpenCV but from skimage