This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def video_to_frames(video): | |
path = os.path.join(config.test_path, 'temporary_images') | |
if os.path.exists(path): | |
shutil.rmtree(path) | |
os.makedirs(path) | |
video_path = os.path.join(config.test_path, 'video', video) | |
count = 0 | |
image_list = [] | |
# Path to video file | |
cap = cv2.VideoCapture(video_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def model_cnn_load(): | |
model = VGG16(weights="imagenet", include_top=True, input_shape=(224, 224, 3)) | |
out = model.layers[-2].output | |
model_final = Model(inputs=model.input, outputs=out) | |
return model_final | |
def load_image(path): | |
img = cv2.imread(path) | |
img = cv2.resize(img, (224, 224)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
time_steps_encoder is the number of frames per video we will be using for training | |
num_encoder_tokens is the number of features from each frame | |
latent_dim is the number of hidden features for lstm | |
time_steps_decoder is the maximum length of each sentence | |
num_decoder_tokens is the final number of tokens in the softmax layer | |
batch size | |
""" | |
time_steps_encoder=80 | |
num_encoder_tokens=4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_datatest(train_path, epochs=100, x_data=x_data, tokenizer=tokenizer, num_decoder_tokens=1500,training_list=train_list, batch_size=32, maxlen=10): | |
encoder_input_data = [] | |
decoder_input_data = [] | |
decoder_target_data = [] | |
videoId = [] | |
videoSeq = [] | |
# separating the videoId and the video captions | |
for idx, cap in enumerate(training_list): | |
caption = cap[0] | |
videoId.append(cap[1]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.