This model was trained on 1000 random screenshots of the TV-show Scavengers Reign (2023) on MAX. I've used the civitai default settings for training.
Workflow
I used a short Python script to grab random images from an MP4 file
Then I used czkawka (github) to get rid of any duplicate or similar images
After that, I checked all the images manually
I used the WD14 Model within kohya_ss (github) for captioning
Finally I uploaded captions and images to civitai for training
Code:
import cv2
import random
mp4_directory = ''
output_directory = ''
frames_to_extract = 120
base_name = "Random_screenshot"
list_of_random_frames = []
frame_distance = 100
first_frame = 0
count = 0
vidcap = cv2.VideoCapture(mp4_directory)
totalFrames = vidcap.get(cv2.CAP_PROP_FRAME_COUNT)
while count < frames_to_extract:
count += 1
count_str = str(count)
frames_skipped = -1
while True:
randomFrameNumber = random.randint(0, totalFrames)
frames_skipped +=1
if frames_skipped > 0:
print(f"Frame Skipped {frames_skipped}")
if all(abs(randomFrameNumber - frame) > frame_distance and randomFrameNumber> first_frame for frame in list_of_random_frames):
break
list_of_random_frames.append(randomFrameNumber)
photo_output = output_directory + basename + count_str + ".png"
vidcap.set(cv2.CAP_PROP_POS_FRAMES,randomFrameNumber)
success, image = vidcap.read()
if success:
cv2.imwrite(photo_output, image)
print(f"Saving image to: {photo_output}")