Skip to content

Commit

Permalink
Log number of used frames to INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
prouast committed Jan 6, 2025
1 parent a644315 commit d4bdbdc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vitallens/methods/vitallens.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def __call__(
start_idxs = [i * (split_len - API_OVERLAP) for i in range(n_splits)]
end_idxs = [min(start + split_len, inputs_n) for start in start_idxs]
start_idxs = [max(0, end - split_len) for end in end_idxs]
logging.info("Running inference for {} frames using {} request(s)...".format(expected_ds_n, n_splits))
logging.info(
f"Analyzing video of {expected_ds_n} frames using {n_splits} request{'s' if n_splits > 1 else ''}. "
f"Using {n_splits * split_len} frames in total{' including overlaps' if n_splits > 1 else ''}...")
# Process the splits in parallel
with concurrent.futures.ThreadPoolExecutor() as executor:
results = list(executor.map(lambda i: self.process_api_batch(
Expand Down Expand Up @@ -244,6 +246,7 @@ def process_api_batch(
payload["state"] = base64.b64encode(self.state.astype(np.float32).tobytes()).decode('utf-8')
# Adjust idxs
idxs = idxs[(self.n_inputs-1):] - (self.n_inputs-1)
logging.debug(f"Providing state, which means that {self.n_inputs-1} less frames will be used and results for {self.n_inputs-1} less frames will be returned.")
# Ask API to process video
response = requests.post(API_URL, headers=headers, json=payload)
response_body = json.loads(response.text)
Expand Down

0 comments on commit d4bdbdc

Please sign in to comment.