Commit
·
41bc78a
1
Parent(s):
281ccac
Added back some logging messages
Browse files- handler.py +5 -5
handler.py
CHANGED
@@ -132,11 +132,11 @@ class EndpointHandler:
|
|
132 |
def embed_frames_with_xclip_processing(self, frames):
|
133 |
# Initialize an empty list to store the frame embeddings
|
134 |
|
135 |
-
|
136 |
frame_preprocessed = self.preprocess_frames(frames)
|
137 |
|
138 |
# Pass the preprocessed frame through the model to get the frame embeddings
|
139 |
-
|
140 |
frame_embedding = self.model.get_video_features(**frame_preprocessed)
|
141 |
|
142 |
# Check the shape of the tensor
|
@@ -150,13 +150,13 @@ class EndpointHandler:
|
|
150 |
# self.logger.info("Skipping normalization due to tensor shape")
|
151 |
batch_emb = frame_embedding.squeeze(0)
|
152 |
|
153 |
-
|
154 |
batch_emb = batch_emb.cpu().detach().numpy()
|
155 |
|
156 |
-
|
157 |
batch_emb = batch_emb.tolist()
|
158 |
|
159 |
-
|
160 |
return batch_emb
|
161 |
|
162 |
def process_video(self, video_url, video_metadata):
|
|
|
132 |
def embed_frames_with_xclip_processing(self, frames):
|
133 |
# Initialize an empty list to store the frame embeddings
|
134 |
|
135 |
+
self.logger.info("Preprocessing frames.")
|
136 |
frame_preprocessed = self.preprocess_frames(frames)
|
137 |
|
138 |
# Pass the preprocessed frame through the model to get the frame embeddings
|
139 |
+
self.logger.info("Getting video features.")
|
140 |
frame_embedding = self.model.get_video_features(**frame_preprocessed)
|
141 |
|
142 |
# Check the shape of the tensor
|
|
|
150 |
# self.logger.info("Skipping normalization due to tensor shape")
|
151 |
batch_emb = frame_embedding.squeeze(0)
|
152 |
|
153 |
+
self.logger.info("Converting into numpy array")
|
154 |
batch_emb = batch_emb.cpu().detach().numpy()
|
155 |
|
156 |
+
self.logger.info("Converting to list")
|
157 |
batch_emb = batch_emb.tolist()
|
158 |
|
159 |
+
self.logger.info("Returning batch_emb list")
|
160 |
return batch_emb
|
161 |
|
162 |
def process_video(self, video_url, video_metadata):
|