use Darknet to train image filters

27 views Asked by At

I want to use Darknet to train a 5x5 convolutional image filter. As an example, I want to train a 5x5 "dilation" filter, so I used the Python to generate random white dots in a black image (the input), then dilated the image (the output / ground truth).

for i in range(100):
    num_dots = random.randint(10, 100)
    dot_pattern = generate_random_dot_pattern(width, height, num_dots)
    dilated_pattern = dilate_image(dot_pattern, dilation_size=3)
    
    original_name = f"pattern_{i}.png"
    dilated_name = f"output_pattern_{i}.png"
    
    original_path = os.path.abspath(original_name)
    dilated_path = os.path.abspath(dilated_name)
    
    cv2.imwrite(original_name, dot_pattern)
    cv2.imwrite(dilated_name, dilated_pattern)
    
    original_pattern_paths.append(original_path)
    dilated_pattern_paths.append(dilated_path)

I then tried using darknet with the following cfg file

[net]
subdivisions=1
inputs=1
batch=1
momentum=0.9
decay=0.001
max_batches =10000
time_steps=1
learning_rate=1
policy=steps
steps=1000,1500
scales=.5,.2
height=400
width=400
channels=1

[convolutional]
batch_normalize=1
filters=1
size=5
stride=1
pad=1
activation=relu

[cost]
type=sse

I customized Darknet so that it loads images as X and Y values and verified the images and ground truth are loaded correctly. However, when I tried to train this network, the loss does not decrease after 10000 epochs, does anyone understand why?

0

There are 0 answers