Reputation: 833
I'm trying to train YOLOV2 on electrical domain objects.
Like transformer, switchboards etc.
I trained multiple objects at 200 DPI. When I run the model with test set of images it gave me good accuracy(.94) but when I test with different DPI's (300 DPI) model couldn't find any objects.
Objects which are used to train are
What am I missing here? Whether the model needs to be trained with all the possible DPIs?
Note: I stopped training when I got 0.2 loss rate. Trained on 98 images. 333 annotations.
Please let me know if I can go with some other Machine learning techniques to detect small object like above.
Upvotes: 0
Views: 426
Reputation: 411
I think this is because large images are scaled down to fix sized images, for example 416x416, such that it can be fed to the input of YOLOv2. If we scale down a image, sometimes thin lies disappear from the original image.
Let me demonstrate with cv2.resize():
import numpy as np
import matplotlib.pyplot as plt
import cv2
# for i in range(10):plt.close()
img_original = np.zeros((100, 100, 3)) # 100 x 100 RGB Black image
img_original[::10, :, :] = 255 # add some white lines
img_resized = cv2.resize(img_original, (10, 10)) # resize into 10 x 10 RGB
fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_subplot(121)
ax1.imshow(img_original)
plt.xlabel('Original 100 x 100')
ax2 = fig.add_subplot(122)
ax2.imshow(img_resized)
plt.xlabel('Resized 10 x 10')
fig.savefig('./demo.jpg')
plt.show()
Upvotes: 1