Commit ·
cd14c77
1
Parent(s): 83cd9c3
Removed some loggings
Browse files- handler.py +8 -8
handler.py
CHANGED
|
@@ -132,31 +132,31 @@ class EndpointHandler:
|
|
| 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
|
| 143 |
-
self.logger.info(f"Shape of the batch_emb tensor: {frame_embedding.shape}")
|
| 144 |
|
| 145 |
# Normalize the embeddings if it's a 2D tensor
|
| 146 |
if frame_embedding.dim() == 2:
|
| 147 |
-
self.logger.info("Normalizing embeddings")
|
| 148 |
batch_emb = torch.nn.functional.normalize(frame_embedding, p=2, dim=1)
|
| 149 |
else:
|
| 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):
|
|
|
|
| 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
|
| 143 |
+
# self.logger.info(f"Shape of the batch_emb tensor: {frame_embedding.shape}")
|
| 144 |
|
| 145 |
# Normalize the embeddings if it's a 2D tensor
|
| 146 |
if frame_embedding.dim() == 2:
|
| 147 |
+
# self.logger.info("Normalizing embeddings")
|
| 148 |
batch_emb = torch.nn.functional.normalize(frame_embedding, p=2, dim=1)
|
| 149 |
else:
|
| 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):
|