Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

Jon/vss2023 (#407)

jonmatthis42f8f1e7c823
diff --git a/README.md b/README.md
index dca91b94..39fa3d31 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
<img src="https://raw.githubusercontent.com/freemocap/freemocap/main/assets/logo/freemocap-logo-black-border.svg" height="64" alt="Project Logo">
</p>
-<h3 align="center">freemocap</h3>
-<p align="center">πŸ“ The FreeMoCap Project: A free-and-open-source, hardware-and-software-agnostic, minimal-cost, research-grade, motion capture system and platform for decentralized scientific research, education, and training</p>
+<h3 align="center">The FreeMoCap Project</h3>
+<h4 align="center"> A free-and-open-source, hardware-and-software-agnostic, minimal-cost, research-grade, motion capture system and platform for decentralized scientific research, education, and training</h2>
<p align="center">
@@ -49,13 +49,13 @@ https://user-images.githubusercontent.com/15314521/192062522-2a8d9305-f181-4869-
1. Install software via [pip](https://pypi.org/project/freemocap/1.0.0rc0/):
```
-pip install freemocap~=1.0.0rc0
+pip install freemocap~=1.0.12rc0
```
2. Launch the GUI by entering the command:
```
freemocap
-```
+```
3. A GUI should pop up that looks like this
<img width="1457" alt="image" src="https://github.com/freemocap/freemocap/assets/15314521/90ef7e7b-48f3-4f46-8d4a-5b5bcc3254b3">
diff --git a/experimental/batch_process/batch_process.py b/experimental/batch_process/batch_process.py
index 9d5cab2f..ea927345 100644
--- a/experimental/batch_process/batch_process.py
+++ b/experimental/batch_process/batch_process.py
@@ -3,7 +3,7 @@ from pathlib import Path
from typing import Optional, Union
from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender import export_to_blender
+from freemocap.export_data.blender_stuff.export_to_blender import export_to_blender
from freemocap.parameter_info_models.recording_info_model import RecordingInfoModel
from freemocap.parameter_info_models.recording_processing_parameter_models import RecordingProcessingParameterModel
from freemocap.system.paths_and_files_names import get_blender_file_path
diff --git a/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/mediapipe_skeleton_detector.py b/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/mediapipe_skeleton_detector.py
index 88f60ee7..bc40423b 100644
--- a/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/mediapipe_skeleton_detector.py
+++ b/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/mediapipe_skeleton_detector.py
@@ -2,7 +2,7 @@ import logging
from dataclasses import dataclass
import multiprocessing
from pathlib import Path
-from typing import Any, List, Union
+from typing import Any, List, Union, Callable
import cv2
import mediapipe as mp
@@ -19,9 +19,16 @@ from freemocap.core_processes.detecting_things_in_2d_images.mediapipe_stuff.medi
from freemocap.parameter_info_models.recording_processing_parameter_models import MediapipeParametersModel
from freemocap.utilities.get_video_paths import get_video_paths
-
logger = logging.getLogger(__name__)
+mp_drawing = mp.solutions.drawing_utils
+mp_drawing_styles = mp.solutions.drawing_styles
+mp_holistic = mp.solutions.holistic
+
+body_drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
+hand_drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
+face_drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
+
@dataclass
class Mediapipe2dNumpyArrays:
@@ -77,25 +84,12 @@ class Mediapipe2dDataPayload:
class MediaPipeSkeletonDetector:
def __init__(
- self,
- parameter_model=MediapipeParametersModel(),
+ self,
+ parameter_model=MediapipeParametersModel(),
):
-
+ self._parameter_model = parameter_model
self._mediapipe_payload_list = []
- self._mp_drawing = mp.solutions.drawing_utils
- self._mp_drawing_styles = mp.solutions.drawing_styles
- self._mp_holistic = mp.solutions.holistic
-
- self._body_drawing_spec = self._mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
- self._hand_drawing_spec = self._mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
- self._face_drawing_spec = self._mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
-
- self._holistic_tracker = self._mp_holistic.Holistic(
- model_complexity=parameter_model.model_complexity,
- min_detection_confidence=parameter_model.min_detection_confidence,
- min_tracking_confidence=parameter_model.min_tracking_confidence,
- )
self._mediapipe_tracked_point_names_dict = mediapipe_tracked_point_names_dict
self.body_names_list = self._mediapipe_tracked_point_names_dict["body"]
@@ -111,44 +105,103 @@ class MediaPipeSkeletonDetector:
self.number_of_face_tracked_points = mp.solutions.face_mesh.FACEMESH_NUM_LANDMARKS_WITH_IRISES
self.number_of_tracked_points_total = (
- self.number_of_body_tracked_points
- + self.number_of_left_hand_tracked_points
- + self.number_of_right_hand_tracked_points
- + self.number_of_face_tracked_points
+ self.number_of_body_tracked_points
+ + self.number_of_left_hand_tracked_points
+ + self.number_of_right_hand_tracked_points
+ + self.number_of_face_tracked_points
)
- def detect_skeleton_in_image(
- self,
- raw_image: np.ndarray = None,
- annotated_image: np.ndarray = None,
- ) -> Mediapipe2dDataPayload:
+ @staticmethod
+ def process_single_video(
+ synchronized_video_file_path: Path,
+ output_data_folder_path: Path,
+ mediapipe_parameters_model: MediapipeParametersModel,
+ annotate_image: Callable,
+ list_of_mediapipe_results_to_npy_arrays: Callable, ):
- mediapipe_results = self._holistic_tracker.process(
- raw_image
- ) # <-this is where the magic happens, i.e. where the raw image is processed by a convolutional neural network to provide an estimate of joint position in pixel coordinates. Please don't forget that this is insane and should not be possible lol
+ logger.info(f"Running `mediapipe` skeleton detection on video: {str(synchronized_video_file_path)}")
- if annotated_image is None:
- annotated_image = raw_image.copy()
+ holistic_tracker = mp_holistic.Holistic(
+ model_complexity=mediapipe_parameters_model.model_complexity,
+ min_detection_confidence=mediapipe_parameters_model.min_detection_confidence,
+ min_tracking_confidence=mediapipe_parameters_model.min_tracking_confidence,
+ )
- annotated_image = self._annotate_image(annotated_image, mediapipe_results)
+ video_capture_object = cv2.VideoCapture(str(synchronized_video_file_path))
- mediapipe_single_frame_npy_data = self._list_of_mediapipe_results_to_npy_arrays(
- [mediapipe_results],
- image_width=annotated_image.shape[0],
- image_height=annotated_image.shape[1],
- )
- mediapipe_single_frame_npy_data.body_frameNumber_trackedPointNumber_XYZ = self._threshold_by_confidence(
- mediapipe_single_frame_npy_data.body_frameNumber_trackedPointNumber_XYZ,
- mediapipe_single_frame_npy_data.body_frameNumber_trackedPointNumber_confidence,
- confidence_threshold=0.5,
- )
+ video_width = video_capture_object.get(cv2.CAP_PROP_FRAME_WIDTH)
+ video_height = video_capture_object.get(cv2.CAP_PROP_FRAME_HEIGHT)
+ video_framerate = video_capture_object.get(cv2.CAP_PROP_FPS)
+
+ video_mediapipe_results_list = []
+ video_annotated_images_list = []
+
+ success, image = video_capture_object.read()
+
+ number_of_frames = int(video_capture_object.get(cv2.CAP_PROP_FRAME_COUNT))
+
+ for frame_number in tqdm(
+ range(number_of_frames),
+ desc=f"mediapiping video: {synchronized_video_file_path.name}",
+ total=number_of_frames,
+ colour="magenta",
+ unit="frames",
+ dynamic_ncols=True,
+ ):
+ if not success or image is None:
+ logger.error(f"Failed to load an image from: {str(synchronized_video_file_path)}")
+ raise Exception
+
+ mediapipe_results = holistic_tracker.process(
+ image
+ ) # <-this is where the magic happens, i.e. where the raw image is processed by a convolutional neural network to provide an estimate of joint position in pixel coordinates. Please don't forget that this is insane and should not be possible lol
+
+ mediapipe_single_frame_npy_data = list_of_mediapipe_results_to_npy_arrays(
+ [mediapipe_results],
+ image_width=image.shape[0],
+ image_height=image.shape[1],
+ )
+
+ confidence_threshold = 0.5
+
+ threshold_mask = mediapipe_single_frame_npy_data.body_frameNumber_trackedPointNumber_confidence < confidence_threshold
+ mediapipe_single_frame_npy_data.body_frameNumber_trackedPointNumber_XYZ[threshold_mask, :] = np.nan
+
+ video_mediapipe_results_list.append(mediapipe_results)
+ annotated_image = annotate_image(image, mediapipe_results)
+ video_annotated_images_list.append(annotated_image)
+
+ success, image = video_capture_object.read()
+
+ try:
+
+ annotated_video_path = output_data_folder_path.parent.parent / ANNOTATED_VIDEOS_FOLDER_NAME
+ annotated_video_path.mkdir(exist_ok=True, parents=True)
+ annotated_video_name = synchronized_video_file_path.stem + "_mediapipe.mp4"
+ annotated_video_save_path = annotated_video_path / annotated_video_name
+
+ logger.info(f"Saving mediapipe annotated video to : {annotated_video_save_path}")
+
+ video_recorder = VideoRecorder()
- return Mediapipe2dDataPayload(
- mediapipe_results=mediapipe_results,
- annotated_image=annotated_image,
- pixel_data_numpy_arrays=mediapipe_single_frame_npy_data,
+ video_recorder.save_image_list_to_disk(
+ image_list=video_annotated_images_list,
+ path_to_save_video_file=annotated_video_save_path,
+ frames_per_second=video_framerate,
+ )
+ except Exception as e:
+ logger.error(f"Failed to save annotated video to disk: {e}")
+ raise e
+
+ camera_mediapipe_2d_single_camera_npy_arrays = list_of_mediapipe_results_to_npy_arrays(
+ video_mediapipe_results_list,
+ image_width=video_width,
+ image_height=video_height,
)
+ # return the numpy array for this video
+ return camera_mediapipe_2d_single_camera_npy_arrays
+
def process_folder_full_of_videos(
self,
path_to_folder_of_videos_to_process: Union[Path, str],
@@ -158,70 +211,19 @@ class MediaPipeSkeletonDetector:
) -> Union[np.ndarray, None]:
path_to_folder_of_videos_to_process = Path(path_to_folder_of_videos_to_process)
-
logger.info(f"processing videos from: {path_to_folder_of_videos_to_process}")
- mediapipe2d_single_camera_npy_arrays_list = []
- for video_number, synchronized_video_file_path in enumerate(get_video_paths(path_to_folder_of_videos_to_process)):
- logger.info(f"Running `mediapipe` skeleton detection on video: {str(synchronized_video_file_path)}")
- video_capture_object = cv2.VideoCapture(str(synchronized_video_file_path))
-
- video_width = video_capture_object.get(cv2.CAP_PROP_FRAME_WIDTH)
- video_height = video_capture_object.get(cv2.CAP_PROP_FRAME_HEIGHT)
- video_framerate = video_capture_object.get(cv2.CAP_PROP_FPS)
-
- video_mediapipe_results_list = []
- video_annotated_images_list = []
-
- success, image = video_capture_object.read()
-
- number_of_frames = int(video_capture_object.get(cv2.CAP_PROP_FRAME_COUNT))
-
- for frame_number in tqdm(
- range(number_of_frames),
- desc=f"mediapiping video: {synchronized_video_file_path.name}",
- total=number_of_frames,
- colour="magenta",
- unit="frames",
- dynamic_ncols=True,
- ):
- if kill_event is not None and kill_event.is_set():
- logger.info("kill event received, exiting mediapipe process")
- return
-
- if not success or image is None:
- logger.error(f"Failed to load an image from: {str(synchronized_video_file_path)}")
- raise Exception
-
- mediapipe2d_data_payload = self.detect_skeleton_in_image(raw_image=image)
- video_mediapipe_results_list.append(mediapipe2d_data_payload.mediapipe_results)
- annotated_image = self._annotate_image(image, mediapipe2d_data_payload.mediapipe_results)
- video_annotated_images_list.append(annotated_image)
-
- success, image = video_capture_object.read()
-
- if save_annotated_videos:
- annotated_video_path = path_to_folder_of_videos_to_process.parent / ANNOTATED_VIDEOS_FOLDER_NAME
- annotated_video_path.mkdir(exist_ok=True, parents=True)
- annotated_video_name = synchronized_video_file_path.stem + "_mediapipe.mp4"
- annotated_video_save_path = annotated_video_path / annotated_video_name
-
- video_recorder = VideoRecorder()
-
- logger.info(f"Saving mediapipe annotated video to : {annotated_video_save_path}")
- video_recorder.save_image_list_to_disk(
- image_list=video_annotated_images_list,
- path_to_save_video_file=annotated_video_save_path,
- frames_per_second=video_framerate,
- )
-
- camera_mediapipe_2d_single_camera_npy_arrays = self._list_of_mediapipe_results_to_npy_arrays(
- video_mediapipe_results_list,
- image_width=video_width,
- image_height=video_height,
- )
+ with multiprocessing.Pool() as pool:
+ video_paths = get_video_paths(path_to_folder_of_videos_to_process)
+ tasks = [(video_path,
+ output_data_folder_path,
+ self._parameter_model,
+ self._annotate_image,
+ self._list_of_mediapipe_results_to_npy_arrays,
+ ) for video_path in
+ video_paths]
+ mediapipe2d_single_camera_npy_arrays_list = pool.starmap(self.process_single_video, tasks)
- mediapipe2d_single_camera_npy_arrays_list.append(camera_mediapipe_2d_single_camera_npy_arrays)
all_cameras_data2d_list = [
m2d.all_data2d_nFrames_nTrackedPts_XY for m2d in mediapipe2d_single_camera_npy_arrays_list
@@ -295,10 +297,10 @@ class MediaPipeSkeletonDetector:
return data2d_numCams_numFrames_numTrackedPts_XY
def _save_mediapipe2d_data_to_npy(
- self,
- data2d_numCams_numFrames_numTrackedPts_XY: np.ndarray,
- body_world_numCams_numFrames_numTrackedPts_XYZ: np.ndarray,
- output_data_folder_path: Union[str, Path],
+ self,
+ data2d_numCams_numFrames_numTrackedPts_XY: np.ndarray,
+ body_world_numCams_numFrames_numTrackedPts_XYZ: np.ndarray,
+ output_data_folder_path: Union[str, Path],
):
mediapipe_2dData_save_path = Path(output_data_folder_path) / MEDIAPIPE_2D_NPY_FILE_NAME
mediapipe_2dData_save_path.parent.mkdir(exist_ok=True, parents=True)
@@ -310,49 +312,51 @@ class MediaPipeSkeletonDetector:
logger.info(f"saving mediapipe body world npy xyz: {mediapipe_body_world_save_path}")
np.save(str(mediapipe_body_world_save_path), body_world_numCams_numFrames_numTrackedPts_XYZ)
- def _annotate_image(self, image, mediapipe_results):
- self._mp_drawing.draw_landmarks(
+ @staticmethod
+ def _annotate_image(image,
+ mediapipe_results):
+ mp_drawing.draw_landmarks(
image=image,
landmark_list=mediapipe_results.face_landmarks,
- connections=self._mp_holistic.FACEMESH_CONTOURS,
+ connections=mp_holistic.FACEMESH_CONTOURS,
landmark_drawing_spec=None,
- connection_drawing_spec=self._mp_drawing_styles.get_default_face_mesh_contours_style(),
+ connection_drawing_spec=mp_drawing_styles.get_default_face_mesh_contours_style(),
)
- self._mp_drawing.draw_landmarks(
+ mp_drawing.draw_landmarks(
image=image,
landmark_list=mediapipe_results.face_landmarks,
- connections=self._mp_holistic.FACEMESH_TESSELATION,
+ connections=mp_holistic.FACEMESH_TESSELATION,
landmark_drawing_spec=None,
- connection_drawing_spec=self._mp_drawing_styles.get_default_face_mesh_tesselation_style(),
+ connection_drawing_spec=mp_drawing_styles.get_default_face_mesh_tesselation_style(),
)
- self._mp_drawing.draw_landmarks(
+ mp_drawing.draw_landmarks(
image=image,
landmark_list=mediapipe_results.pose_landmarks,
- connections=self._mp_holistic.POSE_CONNECTIONS,
- landmark_drawing_spec=self._mp_drawing_styles.get_default_pose_landmarks_style(),
+ connections=mp_holistic.POSE_CONNECTIONS,
+ landmark_drawing_spec=mp_drawing_styles.get_default_pose_landmarks_style(),
)
- self._mp_drawing.draw_landmarks(
+ mp_drawing.draw_landmarks(
image=image,
landmark_list=mediapipe_results.left_hand_landmarks,
- connections=self._mp_holistic.HAND_CONNECTIONS,
+ connections=mp_holistic.HAND_CONNECTIONS,
landmark_drawing_spec=None,
- connection_drawing_spec=self._mp_drawing_styles.get_default_hand_connections_style(),
+ connection_drawing_spec=mp_drawing_styles.get_default_hand_connections_style(),
)
- self._mp_drawing.draw_landmarks(
+ mp_drawing.draw_landmarks(
image=image,
landmark_list=mediapipe_results.right_hand_landmarks,
- connections=self._mp_holistic.HAND_CONNECTIONS,
+ connections=mp_holistic.HAND_CONNECTIONS,
landmark_drawing_spec=None,
- connection_drawing_spec=self._mp_drawing_styles.get_default_hand_connections_style(),
+ connection_drawing_spec=mp_drawing_styles.get_default_hand_connections_style(),
)
return image
def _list_of_mediapipe_results_to_npy_arrays(
- self,
- mediapipe_results_list: List,
- image_width: Union[int, float],
- image_height: Union[int, float],
+ self,
+ mediapipe_results_list: List,
+ image_width: Union[int, float],
+ image_height: Union[int, float],
) -> Mediapipe2dNumpyArrays:
number_of_frames = len(mediapipe_results_list)
@@ -421,13 +425,14 @@ class MediaPipeSkeletonDetector:
for landmark_number, landmark_data in enumerate(frame_results.pose_landmarks.landmark):
body_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 0] = (
- landmark_data.x * image_width
+ landmark_data.x * image_width
)
body_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 1] = (
- landmark_data.y * image_height
+ landmark_data.y * image_height
)
body_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 2] = (
- landmark_data.z * image_width # z is on roughly the same scale as x, according to mediapipe docs
+ landmark_data.z * image_width
+ # z is on roughly the same scale as x, according to mediapipe docs
)
body_frameNumber_trackedPointNumber_confidence[
frame_number, landmark_number
@@ -448,10 +453,10 @@ class MediaPipeSkeletonDetector:
if frame_results.right_hand_landmarks is not None:
for landmark_number, landmark_data in enumerate(frame_results.right_hand_landmarks.landmark):
rightHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 0] = (
- landmark_data.x * image_width
+ landmark_data.x * image_width
)
rightHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 1] = (
- landmark_data.y * image_height
+ landmark_data.y * image_height
)
rightHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 2] = (
landmark_data.z * image_width
@@ -461,10 +466,10 @@ class MediaPipeSkeletonDetector:
if frame_results.left_hand_landmarks is not None:
for landmark_number, landmark_data in enumerate(frame_results.left_hand_landmarks.landmark):
leftHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 0] = (
- landmark_data.x * image_width
+ landmark_data.x * image_width
)
leftHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 1] = (
- landmark_data.y * image_height
+ landmark_data.y * image_height
)
leftHand_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 2] = (
landmark_data.z * image_width
@@ -474,10 +479,10 @@ class MediaPipeSkeletonDetector:
if frame_results.face_landmarks is not None:
for landmark_number, landmark_data in enumerate(frame_results.face_landmarks.landmark):
face_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 0] = (
- landmark_data.x * image_width
+ landmark_data.x * image_width
)
face_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 1] = (
- landmark_data.y * image_height
+ landmark_data.y * image_height
)
face_frameNumber_trackedPointNumber_XYZ[frame_number, landmark_number, 2] = (
landmark_data.z * image_width
@@ -521,14 +526,3 @@ class MediaPipeSkeletonDetector:
body_frameNumber_trackedPointNumber_confidence
),
)
-
- def _threshold_by_confidence(
- self,
- data2d_trackedPoint_dim: np.ndarray,
- data2d_trackedPoint_confidence: np.ndarray,
- confidence_threshold: float,
- ):
-
- threshold_mask = data2d_trackedPoint_confidence < confidence_threshold
- data2d_trackedPoint_dim[threshold_mask, :] = np.nan
- return data2d_trackedPoint_dim
diff --git a/freemocap/core_processes/export_data/__init__.py b/freemocap/export_data/__init__.py
similarity index 100%
rename from freemocap/core_processes/export_data/__init__.py
rename to freemocap/export_data/__init__.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/__init__.py b/freemocap/export_data/blender_stuff/__init__.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/__init__.py
rename to freemocap/export_data/blender_stuff/__init__.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/__init__.py b/freemocap/export_data/blender_stuff/blender_bpy_export_scripts/__init__.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/__init__.py
rename to freemocap/export_data/blender_stuff/blender_bpy_export_scripts/__init__.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/alpha_freemocap_blender_megascript.py b/freemocap/export_data/blender_stuff/blender_bpy_export_scripts/alpha_freemocap_blender_megascript.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/alpha_freemocap_blender_megascript.py
rename to freemocap/export_data/blender_stuff/blender_bpy_export_scripts/alpha_freemocap_blender_megascript.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/cgtinker_blendarmocap_load.py b/freemocap/export_data/blender_stuff/blender_bpy_export_scripts/cgtinker_blendarmocap_load.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/cgtinker_blendarmocap_load.py
rename to freemocap/export_data/blender_stuff/blender_bpy_export_scripts/cgtinker_blendarmocap_load.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/freemocap_blender_megascript_take2.py b/freemocap/export_data/blender_stuff/blender_bpy_export_scripts/freemocap_blender_megascript_take2.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/blender_bpy_export_scripts/freemocap_blender_megascript_take2.py
rename to freemocap/export_data/blender_stuff/blender_bpy_export_scripts/freemocap_blender_megascript_take2.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/call_blender_subprocess_methods.py b/freemocap/export_data/blender_stuff/call_blender_subprocess_methods.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/call_blender_subprocess_methods.py
rename to freemocap/export_data/blender_stuff/call_blender_subprocess_methods.py
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender.py b/freemocap/export_data/blender_stuff/export_to_blender.py
similarity index 89%
rename from freemocap/core_processes/export_data/blender_stuff/export_to_blender.py
rename to freemocap/export_data/blender_stuff/export_to_blender.py
index d3f9c0b0..67206bd2 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender.py
+++ b/freemocap/export_data/blender_stuff/export_to_blender.py
@@ -2,12 +2,12 @@ import logging
from pathlib import Path
from typing import Union
-from freemocap.core_processes.export_data.blender_stuff.call_blender_subprocess_methods import (
+from freemocap.export_data.blender_stuff.call_blender_subprocess_methods import (
call_blender_subprocess_megascript_take2,
call_blender_subprocess_cgtinker,
call_blender_subprocess_alpha_megascript,
)
-from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+from freemocap.export_data.blender_stuff.get_best_guess_of_blender_path import (
get_best_guess_of_blender_path,
)
diff --git a/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py b/freemocap/export_data/blender_stuff/get_best_guess_of_blender_path.py
similarity index 100%
rename from freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
rename to freemocap/export_data/blender_stuff/get_best_guess_of_blender_path.py
diff --git a/freemocap/export_data/generate_jupyter_notebook/__init__.py b/freemocap/export_data/generate_jupyter_notebook/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/freemocap/export_data/generate_jupyter_notebook/freemocap_template.ipynb b/freemocap/export_data/generate_jupyter_notebook/freemocap_template.ipynb
new file mode 100644
index 00000000..e1d0be29
--- /dev/null
+++ b/freemocap/export_data/generate_jupyter_notebook/freemocap_template.ipynb
@@ -0,0 +1,324 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Load necessary libraries\n",
+ "\n",
+ "First, we are importing libraries (also known as \"packages\") that we will use throughout this notebook. In this case, we are using pathlib, numpy, and plotly. If they are not installed, we will install them.\n",
+ "\n",
+ "Pathlib provides methods to handle file and directory paths, numpy allows us to handle arrays, and plotly is the graphing library we will use for visualization.\n",
+ "\n",
+ "If any of these libraries are not installed, we install them directly from this notebook."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "from pathlib import Path\n",
+ "\n",
+ "try:\n",
+ " import numpy as np\n",
+ "except Exception as e:\n",
+ " print(e)\n",
+ " %pip install numpy\n",
+ " import numpy as np\n",
+ "\n",
+ "\n",
+ "try:\n",
+ " from plotly.subplots import make_subplots\n",
+ " import plotly.graph_objects as go\n",
+ "except Exception as e:\n",
+ " print(e)\n",
+ " %pip install plotly\n",
+ " from plotly.subplots import make_subplots\n",
+ " import plotly.graph_objects as go\n",
+ " "
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Define variables\n",
+ "\n",
+ "Next, we're defining a few things we'll need to use later:\n",
+ "\n",
+ "- `path_to_recording`: This is a path to the folder where the mocap data for this recording is stored\n",
+ "- `joint_to_plot`: We need to tell the program which joint we want to visualize. By default, we select the 'nose'.\n",
+ "- `mediapipe_indices`: These are the possible joints that can be visualized.\n",
+ "\n",
+ "You can select a different joint from `mediapipe_indices` to view the plot for that - for example, you could replace `joint_to_plot = 'nose'` with `joint_to_plot = 'left_elbow'` to view the trajectory visualization for the left elbow. \n",
+ "\n",
+ "We're also getting the path to two types of data we need - 'center of mass' and '3D body data'. We will be loading and using these datasets later on."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "tags": [
+ "parameters"
+ ]
+ },
+ "outputs": [],
+ "source": [
+ "path_to_recording = None"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#pick a joint from the mediapipe indices list to plot\n",
+ "joint_to_plot = 'nose'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\n",
+ "mediapipe_indices = ['nose',\n",
+ " 'left_eye_inner',\n",
+ " 'left_eye',\n",
+ " 'left_eye_outer',\n",
+ " 'right_eye_inner',\n",
+ " 'right_eye',\n",
+ " 'right_eye_outer',\n",
+ " 'left_ear',\n",
+ " 'right_ear',\n",
+ " 'mouth_left',\n",
+ " 'mouth_right',\n",
+ " 'left_shoulder',\n",
+ " 'right_shoulder',\n",
+ " 'left_elbow',\n",
+ " 'right_elbow',\n",
+ " 'left_wrist',\n",
+ " 'right_wrist',\n",
+ " 'left_pinky',\n",
+ " 'right_pinky',\n",
+ " 'left_index',\n",
+ " 'right_index',\n",
+ " 'left_thumb',\n",
+ " 'right_thumb',\n",
+ " 'left_hip',\n",
+ " 'right_hip',\n",
+ " 'left_knee',\n",
+ " 'right_knee',\n",
+ " 'left_ankle',\n",
+ " 'right_ankle',\n",
+ " 'left_heel',\n",
+ " 'right_heel',\n",
+ " 'left_foot_index',\n",
+ " 'right_foot_index']\n",
+ "\n",
+ "joint_to_plot_index = mediapipe_indices.index(joint_to_plot)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "path_to_recording = Path(path_to_recording)\n",
+ "path_to_center_of_mass_npy = path_to_recording/'output_data'/'center_of_mass'/'total_body_center_of_mass_xyz.npy'\n",
+ "path_to_freemocap_3d_body_data_npy = path_to_recording/'output_data'/'mediapipe_body_3d_xyz.npy'\n",
+ "\n",
+ "freemocap_3d_body_data = np.load(path_to_freemocap_3d_body_data_npy)\n",
+ "total_body_com_data = np.load(path_to_center_of_mass_npy)\n",
+ "\n",
+ "freemocap_3d_body_data_to_plot = freemocap_3d_body_data[:,joint_to_plot_index,:]\n"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Plotting\n",
+ "\n",
+ "After loading our data, we are going to create some plots to better visualize it. Specifically, we are plotting the trajectory of the total body center of mass and the trajectory of the chosen joint (`nose` by default, but you can replace that and rerun this notebook to plot a different trajectory).\n",
+ "\n",
+ "The first three plots (in column 1) represent the X, Y, and Z trajectories of the total body center of mass. The next three plots (in column 2) represent the X, Y, and Z trajectories of the chosen joint.\n",
+ "\n",
+ "Note: The X, Y, and Z values refer to the three dimensions in space.\n",
+ "\n",
+ "You can click and drag on the plots below to interact with them and zoom into certain areas. When hovering over the plot, you can see additional options in the top right to pan, zoom, reset, and download the plots. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\n",
+ "fig = make_subplots(rows=3, cols=2, subplot_titles=('total body center of mass trajectory',f'{joint_to_plot} trajectory'))\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = total_body_com_data[:,0]),\n",
+ " row=1, col=1\n",
+ ")\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = total_body_com_data[:,1]),\n",
+ " row=2, col=1\n",
+ ")\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = total_body_com_data[:,2]),\n",
+ " row=3, col=1\n",
+ ")\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = freemocap_3d_body_data_to_plot[:,0]),\n",
+ " row=1, col=2\n",
+ ")\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = freemocap_3d_body_data_to_plot[:,1]),\n",
+ " row=2, col=2\n",
+ ")\n",
+ "\n",
+ "fig.add_trace(\n",
+ " go.Scatter(y = freemocap_3d_body_data_to_plot[:,2]),\n",
+ " row=3, col=2\n",
+ ")\n",
+ "\n",
+ "#COM plot axes labels \n",
+ "fig['layout']['yaxis']['title']='X Axis (mm)'\n",
+ "fig['layout']['yaxis3']['title']='Y Axis (mm)'\n",
+ "fig['layout']['yaxis5']['title']='Z Axis (mm)'\n",
+ "fig['layout']['xaxis5']['title']='Frame #'\n",
+ "fig['layout']['xaxis6']['title']='Frame #'\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "fig.update_layout(height=600, width=800,showlegend=False)\n",
+ "fig.show()\n"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## 3D Plotting\n",
+ "\n",
+ "Finally, we are creating a 3D plot of the skeleton movement, tracking all the joints in the `mediapipe_indices` list over time. \n",
+ "\n",
+ "The 'Play' button at the bottom allows you to watch the motion as if it were a video. Before pressing play, you can manually click and drag the plot around to orient the view of the plot. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\n",
+ "def calculate_axes_means(skeleton_3d_data):\n",
+ " mx_skel = np.nanmean(skeleton_3d_data[:,0:33,0])\n",
+ " my_skel = np.nanmean(skeleton_3d_data[:,0:33,1])\n",
+ " mz_skel = np.nanmean(skeleton_3d_data[:,0:33,2])\n",
+ "\n",
+ " return mx_skel, my_skel, mz_skel\n",
+ "\n",
+ "ax_range = 1500\n",
+ "\n",
+ "mx_skel, my_skel, mz_skel = calculate_axes_means(freemocap_3d_body_data)\n",
+ "\n",
+ "# Create a list of frames\n",
+ "frames = [go.Frame(data=[go.Scatter3d(\n",
+ " x=freemocap_3d_body_data[i, :, 0],\n",
+ " y=freemocap_3d_body_data[i, :, 1],\n",
+ " z=freemocap_3d_body_data[i, :, 2],\n",
+ " mode='markers',\n",
+ " marker=dict(\n",
+ " size=2, # Adjust marker size as needed\n",
+ " )\n",
+ ")], name=str(i)) for i in range(freemocap_3d_body_data.shape[0])]\n",
+ "\n",
+ "# Define axis properties\n",
+ "axis = dict(\n",
+ " showbackground=True,\n",
+ " backgroundcolor=\"rgb(230, 230,230)\",\n",
+ " gridcolor=\"rgb(255, 255, 255)\",\n",
+ " zerolinecolor=\"rgb(255, 255, 255)\",\n",
+ ")\n",
+ "\n",
+ "# Create a figure\n",
+ "fig = go.Figure(\n",
+ " data=[go.Scatter3d(\n",
+ " x=freemocap_3d_body_data[0, :, 0],\n",
+ " y=freemocap_3d_body_data[0, :, 1],\n",
+ " z=freemocap_3d_body_data[0, :, 2],\n",
+ " mode='markers',\n",
+ " marker=dict(\n",
+ " size=2, # Adjust marker size as needed\n",
+ " )\n",
+ " )],\n",
+ " layout=go.Layout(\n",
+ " scene=dict(\n",
+ " xaxis=dict(axis, range=[mx_skel-ax_range, mx_skel+ax_range]), # Adjust range as needed\n",
+ " yaxis=dict(axis, range=[my_skel-ax_range, my_skel+ax_range]), # Adjust range as needed\n",
+ " zaxis=dict(axis, range=[mz_skel-ax_range, mz_skel+ax_range]), # Adjust range as needed\n",
+ " aspectmode='cube'\n",
+ " ),\n",
+ " updatemenus=[dict(\n",
+ " type='buttons',\n",
+ " showactive=False,\n",
+ " buttons=[dict(\n",
+ " label='Play',\n",
+ " method='animate',\n",
+ " args=[None, {\"frame\": {\"duration\": 30}}]\n",
+ " )]\n",
+ " )]\n",
+ " ),\n",
+ " frames=frames\n",
+ ")\n",
+ "\n",
+ "fig.show()"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "validation_req_test",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.16"
+ },
+ "orig_nbformat": 4
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/freemocap/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py b/freemocap/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py
new file mode 100644
index 00000000..14b1794a
--- /dev/null
+++ b/freemocap/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py
@@ -0,0 +1,25 @@
+import logging
+from pathlib import Path
+from typing import Union
+
+import papermill as pm
+logging.getLogger('papermill').setLevel(logging.WARNING)
+logger = logging.getLogger(__name__)
+
+
+def generate_jupyter_notebook(path_to_recording: Union[str, Path]):
+ recording_name = Path(path_to_recording).name
+ path_to_template_notebook = Path(__file__).parent / "freemocap_template.ipynb"
+ path_to_output_notebook = Path(path_to_recording) / f"{recording_name}.ipynb"
+
+ logger.info(f"Jupyter notebook generated at {path_to_output_notebook}")
+ success = pm.execute_notebook(
+ input_path=path_to_template_notebook,
+ output_path=path_to_output_notebook,
+ parameters=dict(path_to_recording=path_to_recording)
+ )
+
+
+if __name__ == '__main__':
+ path_to_recording = r'C:\Users\aaron\FreeMocap_Data\recording_sessions\recording_15_19_00_gmt-4__brit_baseline'
+ generate_jupyter_notebook(path_to_recording)
diff --git a/freemocap/gui/qt/main_window/freemocap_main_window.py b/freemocap/gui/qt/main_window/freemocap_main_window.py
index 41f2ec6e..68b29033 100644
--- a/freemocap/gui/qt/main_window/freemocap_main_window.py
+++ b/freemocap/gui/qt/main_window/freemocap_main_window.py
@@ -10,7 +10,7 @@ from PyQt6.QtWidgets import (
QDockWidget,
QMainWindow,
QFileDialog,
- QTabWidget, QWidget, QHBoxLayout, )
+ QWidget, QHBoxLayout, )
from skelly_viewer import SkellyViewer
from skellycam import (
SkellyCamParameterTreeWidget,
@@ -19,11 +19,12 @@ from skellycam import (
)
from tqdm import tqdm
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender import (
+from freemocap.export_data.blender_stuff.export_to_blender import (
export_to_blender,
)
-from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import \
+from freemocap.export_data.blender_stuff.get_best_guess_of_blender_path import \
get_best_guess_of_blender_path
+from freemocap.export_data.generate_jupyter_notebook.generate_jupyter_notebook import generate_jupyter_notebook
from freemocap.gui.qt.actions_and_menus.actions import Actions
from freemocap.gui.qt.actions_and_menus.menu_bar import MenuBar
from freemocap.gui.qt.style_sheet.css_file_watcher import CSSFileWatcher
@@ -44,17 +45,19 @@ from freemocap.gui.qt.widgets.control_panel.process_mocap_data_panel.process_mot
)
from freemocap.gui.qt.widgets.control_panel.visualization_control_panel import VisualizationControlPanel
from freemocap.gui.qt.widgets.directory_view_widget import DirectoryViewWidget
-from freemocap.gui.qt.widgets.import_videos_window import ImportVideosWizard
-from freemocap.gui.qt.widgets.log_view_widget import LogViewWidget
from freemocap.gui.qt.widgets.home_widget import (
HomeWidget,
)
+from freemocap.gui.qt.widgets.import_videos_window import ImportVideosWizard
+from freemocap.gui.qt.widgets.log_view_widget import LogViewWidget
from freemocap.parameter_info_models.recording_info_model import (
RecordingInfoModel,
)
from freemocap.parameter_info_models.recording_processing_parameter_models import (
RecordingProcessingParameterModel,
)
+# reboot GUI method based on this - https://stackoverflow.com/a/56563926/14662833
+from freemocap.system.open_file import open_file
from freemocap.system.paths_and_files_names import (
get_scss_stylesheet_path,
get_css_stylesheet_path,
@@ -62,12 +65,7 @@ from freemocap.system.paths_and_files_names import (
PATH_TO_FREEMOCAP_LOGO_SVG,
get_blender_file_path,
get_recording_session_folder_path,
- DIRECTORY_EMOJI_STRING,
- GEAR_EMOJI_STRING,
- COOL_EMOJI_STRING,
)
-# reboot GUI method based on this - https://stackoverflow.com/a/56563926/14662833
-from freemocap.system.start_file import open_file
from freemocap.system.user_data.pipedream_pings import PipedreamPings
EXIT_CODE_REBOOT = -123456789
@@ -88,7 +86,7 @@ class FreemocapMainWindow(QMainWindow):
self.setGeometry(100, 100, 1280, 720)
self.setWindowIcon(QIcon(PATH_TO_FREEMOCAP_LOGO_SVG))
- self.setWindowTitle("freemocap \U0001F480 \U00002728")
+ self.setWindowTitle(f"freemocap \U0001F480 \U00002728")
dummy_widget = QWidget()
self._layout = QHBoxLayout()
@@ -183,6 +181,10 @@ class FreemocapMainWindow(QMainWindow):
if self._controller_group_box.auto_open_in_blender_checked and not self._kill_thread_event.is_set():
logger.info("'Auto process videos' checkbox is checked - triggering 'Create Blender Scene'")
self._export_active_recording_to_blender()
+ if self._controller_group_box.generate_jupyter_notebook_checked and not self._kill_thread_event.is_set():
+ self._generate_jupyter_notebook()
+
+
def handle_start_new_session_action(self):
# self._central_tab_widget.set_welcome_tab_enabled(True)
@@ -297,6 +299,11 @@ class FreemocapMainWindow(QMainWindow):
self._export_active_recording_to_blender
)
+ self._visualization_control_panel.generate_jupyter_notebook_button.clicked.connect(
+ self._generate_jupyter_notebook
+ )
+
+
return ControlPanelWidget(
camera_configuration_parameter_tree_widget=self._camera_configuration_parameter_tree_widget,
# calibration_control_panel=self._calibration_control_panel,
@@ -330,6 +337,14 @@ class FreemocapMainWindow(QMainWindow):
else:
logger.error("Blender file does not exist! Did something go wrong in the `export_to_blender` call above?")
+ def _generate_jupyter_notebook(self):
+ logger.info("Exporting active recording to a Jupyter notebook...")
+ recording_path = self._active_recording_info_widget.get_active_recording_info(return_path=True)
+ # TODO: Need to include jupyter notebook in recording files that we keep track of (2023-05-15)
+ generate_jupyter_notebook(
+ path_to_recording=recording_path
+ )
+
def _handle_new_active_recording_selected(self, recording_info_model: RecordingInfoModel):
logger.info(f"New active recording selected: {recording_info_model.path}")
@@ -482,12 +497,16 @@ class FreemocapMainWindow(QMainWindow):
def closeEvent(self, a0) -> None:
logger.info("Main window `closeEvent` detected")
- self._pipedream_pings.update_pings_dict(key="gui_closed", value=True)
- self._pipedream_pings.update_pings_dict(key="active recording status on close",
- value=self._active_recording_info_widget.active_recording_info.status_check)
- self._pipedream_pings.send_pipedream_ping()
+ if self._home_widget.consent_to_send_usage_information:
+ self._pipedream_pings.update_pings_dict(key="gui_closed", value=True)
+ self._pipedream_pings.update_pings_dict(key="active recording status on close",
+ value=self._active_recording_info_widget.active_recording_info.status_check)
+ self._pipedream_pings.send_pipedream_ping()
- remove_empty_directories(get_recording_session_folder_path())
+ try:
+ remove_empty_directories(get_recording_session_folder_path())
+ except Exception as e:
+ logger.error(f"Error while removing empty directories: {e}")
try:
self._skellycam_widget.close()
diff --git a/freemocap/gui/qt/widgets/camera_controller_group_box.py b/freemocap/gui/qt/widgets/camera_controller_group_box.py
index 454b8bce..87e30f3f 100644
--- a/freemocap/gui/qt/widgets/camera_controller_group_box.py
+++ b/freemocap/gui/qt/widgets/camera_controller_group_box.py
@@ -37,8 +37,6 @@ class CameraControllerGroupBox(QGroupBox):
# self._layout.setSpacing(0)
self._layout.setAlignment(Qt.AlignmentFlag.AlignTop)
-
-
motion_capture_recording_options_layout = self._create_mocap_recording_option_layout()
self._layout.addLayout(motion_capture_recording_options_layout)
@@ -87,6 +85,11 @@ class CameraControllerGroupBox(QGroupBox):
self._auto_process_videos_checkbox = QCheckBox("Auto Process Videos on Save")
self._auto_process_videos_checkbox.setChecked(True)
hbox.addWidget(self._auto_process_videos_checkbox)
+
+ self._generate_jupyter_notebook_checkbox = QCheckBox('Generate Jupyter Notebook')
+ self._generate_jupyter_notebook_checkbox.setChecked(True)
+ hbox.addWidget(self._generate_jupyter_notebook_checkbox)
+
self._auto_open_in_blender_checkbox = QCheckBox("Auto Open in Blender")
self._auto_open_in_blender_checkbox.setChecked(True)
hbox.addWidget(self._auto_open_in_blender_checkbox)
@@ -128,6 +131,10 @@ class CameraControllerGroupBox(QGroupBox):
def auto_open_in_blender_checked(self) -> bool:
return self._auto_open_in_blender_checkbox.isChecked()
+ @property
+ def generate_jupyter_notebook_checked(self) -> bool:
+ return self._generate_jupyter_notebook_checkbox.isChecked()
+
@property
def charuco_square_size(self) -> float:
return float(self._charuco_square_size_line_edit.text())
diff --git a/freemocap/gui/qt/widgets/control_panel/visualization_control_panel.py b/freemocap/gui/qt/widgets/control_panel/visualization_control_panel.py
index 99233b1d..b491d079 100644
--- a/freemocap/gui/qt/widgets/control_panel/visualization_control_panel.py
+++ b/freemocap/gui/qt/widgets/control_panel/visualization_control_panel.py
@@ -27,6 +27,9 @@ class VisualizationControlPanel(QWidget):
self._layout = QVBoxLayout()
self.setLayout(self._layout)
+ self._generate_jupyter_notebook = QPushButton("Generate Jupyter Notebook")
+ self._layout.addWidget(self._generate_jupyter_notebook)
+
groupbox = QGroupBox("Export to Blender", parent=self)
self._layout.addWidget(groupbox)
vbox = QVBoxLayout()
@@ -66,6 +69,10 @@ class VisualizationControlPanel(QWidget):
def export_to_blender_button(self):
return self._export_to_blender_button
+ @property
+ def generate_jupyter_notebook_button(self):
+ return self._generate_jupyter_notebook
+
@property
def open_in_blender_automatically_box_is_checked(self):
return self._open_in_blender_automatically_checkbox.isChecked()
diff --git a/freemocap/gui/qt/widgets/directory_view_widget.py b/freemocap/gui/qt/widgets/directory_view_widget.py
index 90367b1c..af7e8398 100644
--- a/freemocap/gui/qt/widgets/directory_view_widget.py
+++ b/freemocap/gui/qt/widgets/directory_view_widget.py
@@ -9,7 +9,7 @@ from PyQt6.QtWidgets import QLabel, QMenu, QTreeView, QVBoxLayout, QWidget, QPus
from qtpy import QtGui
from freemocap.system.paths_and_files_names import get_recording_session_folder_path
-from freemocap.system.start_file import open_file
+from freemocap.system.open_file import open_file
logger = logging.getLogger(__name__)
diff --git a/freemocap/gui/qt/widgets/home_widget.py b/freemocap/gui/qt/widgets/home_widget.py
index 0a90414f..ffdec296 100644
--- a/freemocap/gui/qt/widgets/home_widget.py
+++ b/freemocap/gui/qt/widgets/home_widget.py
@@ -7,9 +7,10 @@ from PyQt6.QtWidgets import (
QLabel,
QPushButton,
QVBoxLayout,
- QWidget,
+ QWidget, QHBoxLayout,
)
+import freemocap
from freemocap.gui.qt.actions_and_menus.actions import (
CREATE_NEW_RECORDING_ACTION_NAME,
LOAD_MOST_RECENT_RECORDING_ACTION_NAME,
@@ -67,20 +68,65 @@ class HomeWidget(QWidget):
self._import_videos_button.clicked.connect(actions.import_videos_action.trigger)
self._layout.addWidget(self._import_videos_button, alignment=Qt.AlignmentFlag.AlignCenter)
- self._layout.addStretch(1)
+ # self._layout.addStretch(1)
- send_pings_string = "Send anonymous usage information"
- self._send_pings_checkbox = QCheckBox(send_pings_string)
- self._send_pings_checkbox.setChecked(True)
- self._layout.addWidget(self._send_pings_checkbox, alignment=Qt.AlignmentFlag.AlignCenter)
+ self._create_user_info_consent_checkbox()
- privacy_policy_link_string = '<a href="https://freemocap.readthedocs.io/en/latest/privacy_policy/" style="color: #333333;">Click here to view our privacy policy</a>'
- self._privacy_policy_link = QLabel(privacy_policy_link_string)
- self._privacy_policy_link.setOpenExternalLinks(True)
- self._layout.addWidget(self._privacy_policy_link, alignment=Qt.AlignmentFlag.AlignCenter)
+ self._add_code_and_docs_links()
+ self._make_version_label()
self.style().polish(self)
+ def _make_version_label(self):
+ hbox = QHBoxLayout()
+ self._layout.addLayout(hbox)
+ version_label = QLabel(f"{freemocap.__version__}")
+ version_label.setAlignment(Qt.AlignmentFlag.AlignRight)
+ version_label.setStyleSheet("font-size: 14px;color: #777777")
+ hbox.addWidget(version_label)
+
+ def _add_code_and_docs_links(self):
+ hbox = QHBoxLayout()
+ self._layout.addLayout(hbox)
+ hbox.addStretch(1)
+ privacy_policy_link_string = '<a href="https://freemocap.readthedocs.io/en/latest/privacy_policy/" style="color: #333333;">privacy policy</a>'
+ privacy_policy_link_label = QLabel(privacy_policy_link_string)
+ privacy_policy_link_label.setOpenExternalLinks(True)
+ hbox.addWidget(privacy_policy_link_label)
+ source_code_label = f'<a href="https://github.com/freemocap/freemocap" style="color: #333333;">code</a>'
+ source_code_label = QLabel(source_code_label)
+ source_code_label.setOpenExternalLinks(True)
+ hbox.addWidget(source_code_label, alignment=Qt.AlignmentFlag.AlignCenter)
+ # vbox.addWidget(QLabel("|"))
+ docs_string = '<a href="https://freemocap.readthedocs.io/en/latest/" style="color: #333333;">docs</a>'
+ docs_string = QLabel(docs_string)
+ docs_string.setOpenExternalLinks(True)
+ hbox.addWidget(docs_string, alignment=Qt.AlignmentFlag.AlignCenter)
+ hbox.addStretch(1)
+
+
+
+
+ def _create_user_info_consent_checkbox(self):
+
+ hbox = QHBoxLayout()
+ self._layout.addLayout(hbox)
+ hbox.addStretch(1)
+ self._send_pings_checkbox = QCheckBox("Send anonymous usage information")
+ self._send_pings_checkbox.setChecked(True)
+ hbox.addWidget(self._send_pings_checkbox)
+
+
+
+
+
+ hbox.addStretch(1)
+
+ @property
+ def consent_to_send_usage_information(self):
+ return self._send_pings_checkbox.isChecked()
+
+
def _welcome_to_freemocap_title(self):
# TO DO - this shouldn't be part of the `camera_view_panel` - it should be its own thing that gets swapped out on session start
logger.info("Creating `welcome to freemocap` layout")
diff --git a/freemocap/gui/qt/widgets/import_videos_window.py b/freemocap/gui/qt/widgets/import_videos_window.py
index 0033cbfa..3da69617 100644
--- a/freemocap/gui/qt/widgets/import_videos_window.py
+++ b/freemocap/gui/qt/widgets/import_videos_window.py
@@ -8,7 +8,7 @@ from PyQt6.QtWidgets import QVBoxLayout, QListWidget, QLabel, QFormLayout, QLine
QTreeView, QPushButton, QDialog
from freemocap.system.paths_and_files_names import get_recording_session_folder_path, SYNCHRONIZED_VIDEOS_FOLDER_NAME
-from freemocap.system.start_file import open_file
+from freemocap.system.open_file import open_file
no_files_found_string = "No '.mp4' video files found! \n \n Note - We only look for `.mp4` files (for now). If your videos are a different format, convert them to `mp4` via online tools like `www.cloudconvert.com`, or softwares like `HandBrake`, `ffmpeg` or any video editing software"
diff --git a/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py b/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
index 1115af30..14d406b0 100644
--- a/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
+++ b/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
@@ -20,14 +20,7 @@ class ProcessMotionCaptureDataThreadWorker(QThread):
super().__init__()
self._session_processing_parameters = session_processing_parameters
self._kill_event = kill_event
-
-
- @property
- def work_done(self):
- return self._work_done
-
- def _emit_in_progress_data(self, message: str):
- self.in_progress.emit(message)
+ self._process = multiprocessing.Process(target=process_recording_folder, args=(self._session_processing_parameters, self._kill_event))
def run(self):
logger.info(
@@ -35,15 +28,13 @@ class ProcessMotionCaptureDataThreadWorker(QThread):
)
self._kill_event.clear()
- process_recording_folder(
- recording_processing_parameter_model=self._session_processing_parameters,
- kill_event=self._kill_event,
- )
+ try:
+ self._process.start()
+ self._process.join()
+ except Exception as e:
+ logger.error(f"Error processing motion capture data: {e}")
+
logger.info("Finished processing session folder!")
self.finished.emit()
- self._work_done = True
-
- def kill(self):
- self.terminate()
diff --git a/freemocap/system/start_file.py b/freemocap/system/open_file.py
similarity index 100%
rename from freemocap/system/start_file.py
rename to freemocap/system/open_file.py
diff --git a/freemocap/tests/conftest.py b/freemocap/tests/conftest.py
index 44d69db9..5c27f980 100644
--- a/freemocap/tests/conftest.py
+++ b/freemocap/tests/conftest.py
@@ -1,8 +1,8 @@
import pytest
-from freemocap.tests.utilities.import_sample_data import (
+from freemocap.tests.utilities.load_sample_data import (
load_sample_data,
- find_data_folder_path,
+ find_output_data_folder_path,
find_raw_skeleton_npy_file_name,
find_synchronized_videos_folder_path,
find_image_tracking_data_file_name,
@@ -32,24 +32,27 @@ def synchronized_video_folder_path():
@pytest.fixture
def data_folder_path():
- return find_data_folder_path(pytest.sample_session_folder_path)
+ return find_output_data_folder_path(pytest.sample_session_folder_path)
@pytest.fixture
def raw_skeleton_npy_file_path():
- return find_raw_skeleton_npy_file_name(find_data_folder_path(pytest.sample_session_folder_path))
+ return find_raw_skeleton_npy_file_name(find_output_data_folder_path(pytest.sample_session_folder_path))
@pytest.fixture
def total_body_center_of_mass_file_path():
- return find_total_body_center_of_mass_file_name(find_data_folder_path(pytest.sample_session_folder_path))
+ return find_total_body_center_of_mass_file_name(find_output_data_folder_path(pytest.sample_session_folder_path))
@pytest.fixture
def image_tracking_data_file_name():
- return find_image_tracking_data_file_name(find_data_folder_path(pytest.sample_session_folder_path))
+ return find_image_tracking_data_file_name(find_output_data_folder_path(pytest.sample_session_folder_path))
@pytest.fixture
def reprojection_error_file_name():
- return find_reprojection_error_file_name(find_data_folder_path(pytest.sample_session_folder_path))
+ return find_reprojection_error_file_name(find_output_data_folder_path(pytest.sample_session_folder_path))
+
+if __name__ == "__main__":
+ pytest_sessionstart()
\ No newline at end of file
diff --git a/freemocap/tests/utilities/import_sample_data.py b/freemocap/tests/utilities/import_sample_data.py
deleted file mode 100644
index 10d0cd36..00000000
--- a/freemocap/tests/utilities/import_sample_data.py
+++ /dev/null
@@ -1,94 +0,0 @@
-import io
-import requests
-import zipfile
-from pathlib import Path
-
-from freemocap.system.paths_and_files_names import (
- CENTER_OF_MASS_FOLDER_NAME,
- FIGSHARE_SAMPLE_DATA_FILE_NAME,
- FIGSHARE_ZIP_FILE_URL,
- MEDIAPIPE_2D_NPY_FILE_NAME,
- RAW_MEDIAPIPE_3D_NPY_FILE_NAME,
- MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME,
- OUTPUT_DATA_FOLDER_NAME,
- RAW_DATA_FOLDER_NAME,
- SYNCHRONIZED_VIDEOS_FOLDER_NAME,
- TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME,
-)
-
-
-def load_sample_data() -> Path:
- extract_to_path = Path.home()
- extract_to_path.mkdir(exist_ok=True)
-
- figshare_sample_data_path = extract_to_path / FIGSHARE_SAMPLE_DATA_FILE_NAME
-
- if not Path.exists(figshare_sample_data_path):
- r = requests.get(FIGSHARE_ZIP_FILE_URL)
- z = zipfile.ZipFile(io.BytesIO(r.content))
- z.extractall(extract_to_path)
-
- return figshare_sample_data_path
-
-
-def find_data_folder_path(session_folder_path: Path) -> Path:
- for subfolder_path in session_folder_path.iterdir():
- if subfolder_path.name == OUTPUT_DATA_FOLDER_NAME:
- return subfolder_path
-
- raise Exception(f"Could not find a data folder in path {str(session_folder_path)}")
-
-
-def find_synchronized_videos_folder_path(session_folder_path: Path) -> Path:
- for subfolder_path in session_folder_path.iterdir():
- if subfolder_path.name == SYNCHRONIZED_VIDEOS_FOLDER_NAME:
- return subfolder_path
-
- raise Exception(f"Could not find a videos folder in path {str(session_folder_path)}")
-
-
-def find_raw_skeleton_npy_file_name(data_folder_name: Path) -> Path:
- raw_data_subfolder_path = data_folder_name / RAW_DATA_FOLDER_NAME
- if raw_data_subfolder_path.exists:
- raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
- if RAW_MEDIAPIPE_3D_NPY_FILE_NAME in raw_data_npy_path_list:
- return raw_data_subfolder_path / RAW_MEDIAPIPE_3D_NPY_FILE_NAME
-
- raise Exception(f"Could not find a skeleton NPY file in path {str(data_folder_name)}")
-
-
-def find_total_body_center_of_mass_file_name(data_folder_name: Path) -> Path:
- center_of_mass_subfolder_path = data_folder_name / CENTER_OF_MASS_FOLDER_NAME
- if center_of_mass_subfolder_path.exists:
- center_of_mass_npy_path_list = [path.name for path in center_of_mass_subfolder_path.glob("*.npy")]
-
- if TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME in center_of_mass_npy_path_list:
- return center_of_mass_subfolder_path / TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME
-
- raise Exception(f"Could not find a total body center of mass npy file in path {str(data_folder_name)}")
-
-
-def find_image_tracking_data_file_name(data_folder_name: Path) -> Path:
- raw_data_subfolder_path = data_folder_name / RAW_DATA_FOLDER_NAME
- if raw_data_subfolder_path.exists:
- raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
-
- if MEDIAPIPE_2D_NPY_FILE_NAME in raw_data_npy_path_list:
- return raw_data_subfolder_path / MEDIAPIPE_2D_NPY_FILE_NAME
-
- raise Exception(f"Could not find a 2d data file in path {str(data_folder_name)}")
-
-
-def find_reprojection_error_file_name(data_folder_name: Path) -> Path:
- raw_data_subfolder_path = data_folder_name / RAW_DATA_FOLDER_NAME
- if raw_data_subfolder_path.exists:
- raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
-
- if MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME in raw_data_npy_path_list:
- return raw_data_subfolder_path / MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME
-
- raise Exception(f"Could not find reprojection error data file in path {str(data_folder_name)}")
-
-
-if __name__ == "__main__":
- sample_data_path = load_sample_data()
diff --git a/freemocap/tests/utilities/load_sample_data.py b/freemocap/tests/utilities/load_sample_data.py
new file mode 100644
index 00000000..049b8b78
--- /dev/null
+++ b/freemocap/tests/utilities/load_sample_data.py
@@ -0,0 +1,111 @@
+import io
+import logging
+from typing import Union
+
+import requests
+import zipfile
+from pathlib import Path
+
+from freemocap.system.paths_and_files_names import (
+ CENTER_OF_MASS_FOLDER_NAME,
+ FIGSHARE_SAMPLE_DATA_FILE_NAME,
+ FIGSHARE_ZIP_FILE_URL,
+ MEDIAPIPE_2D_NPY_FILE_NAME,
+ RAW_MEDIAPIPE_3D_NPY_FILE_NAME,
+ MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME,
+ OUTPUT_DATA_FOLDER_NAME,
+ RAW_DATA_FOLDER_NAME,
+ SYNCHRONIZED_VIDEOS_FOLDER_NAME,
+ TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME, get_recording_session_folder_path,
+)
+
+logger = logging.getLogger(__name__)
+
+# TODO - some of the naming in this file is inconsistent with the rest of the codebase. Needs fixed at some point. Also I think a lot of the `find_..` functions should be in a different file?
+
+
+def load_sample_data(sample_data_zip_file_url: str = FIGSHARE_ZIP_FILE_URL) -> str:
+ try:
+ logger.info(f"Downloading sample data from {sample_data_zip_file_url}...")
+
+ recording_session_folder_path = Path(get_recording_session_folder_path())
+ recording_session_folder_path.mkdir(parents=True, exist_ok=True)
+
+ r = requests.get(FIGSHARE_ZIP_FILE_URL, stream=True)
+ r.raise_for_status() # Check if request was successful
+
+ z = zipfile.ZipFile(io.BytesIO(r.content))
+ z.extractall(recording_session_folder_path)
+
+ figshare_sample_data_path = recording_session_folder_path / FIGSHARE_SAMPLE_DATA_FILE_NAME
+ logger.info(f"Sample data extracted to {str(figshare_sample_data_path)}")
+ return str(figshare_sample_data_path)
+
+ except requests.exceptions.RequestException as e:
+ logger.error(f"Request failed: {e}")
+ except zipfile.BadZipFile as e:
+ logger.error(f"Failed to unzip the file: {e}")
+
+
+def find_output_data_folder_path(recording_folder_path: Union[str,Path])->str:
+ for subfolder_path in Path(recording_folder_path).iterdir():
+ if subfolder_path.name == OUTPUT_DATA_FOLDER_NAME:
+ return str(subfolder_path)
+
+ raise Exception(f"Could not find a data folder in path {str(recording_folder_path)}")
+
+
+def find_synchronized_videos_folder_path(recording_folder_path: Union[str, Path]) -> str:
+ for subfolder_path in Path(recording_folder_path).iterdir():
+ if subfolder_path.name == SYNCHRONIZED_VIDEOS_FOLDER_NAME:
+ return str(subfolder_path)
+
+ raise Exception(f"Could not find a videos folder in path {str(recording_folder_path)}")
+
+
+def find_raw_skeleton_npy_file_name(data_folder_name: Union[str,Path])->str:
+ raw_data_subfolder_path = Path(data_folder_name) / RAW_DATA_FOLDER_NAME
+ if raw_data_subfolder_path.exists:
+ raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
+ if RAW_MEDIAPIPE_3D_NPY_FILE_NAME in raw_data_npy_path_list:
+ return str(raw_data_subfolder_path / RAW_MEDIAPIPE_3D_NPY_FILE_NAME)
+
+ raise Exception(f"Could not find a skeleton NPY file in path {str(data_folder_name)}")
+
+
+def find_total_body_center_of_mass_file_name(data_folder_name: Union[str,Path])->str:
+ center_of_mass_subfolder_path = Path(data_folder_name) / CENTER_OF_MASS_FOLDER_NAME
+ if center_of_mass_subfolder_path.exists:
+ center_of_mass_npy_path_list = [path.name for path in center_of_mass_subfolder_path.glob("*.npy")]
+
+ if TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME in center_of_mass_npy_path_list:
+ return str(center_of_mass_subfolder_path / TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)
+
+ raise Exception(f"Could not find a total body center of mass npy file in path {str(data_folder_name)}")
+
+
+def find_image_tracking_data_file_name(data_folder_name: Union[str,Path])->str:
+ raw_data_subfolder_path = Path(data_folder_name) / RAW_DATA_FOLDER_NAME
+ if raw_data_subfolder_path.exists:
+ raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
+
+ if MEDIAPIPE_2D_NPY_FILE_NAME in raw_data_npy_path_list:
+ return str(raw_data_subfolder_path / MEDIAPIPE_2D_NPY_FILE_NAME)
+
+ raise Exception(f"Could not find a 2d data file in path {str(data_folder_name)}")
+
+
+def find_reprojection_error_file_name(data_folder_name: Union[str,Path])->str:
+ raw_data_subfolder_path = Path(data_folder_name) / RAW_DATA_FOLDER_NAME
+ if raw_data_subfolder_path.exists:
+ raw_data_npy_path_list = [path.name for path in raw_data_subfolder_path.glob("*.npy")]
+
+ if MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME in raw_data_npy_path_list:
+ return str(raw_data_subfolder_path / MEDIAPIPE_REPROJECTION_ERROR_NPY_FILE_NAME)
+
+ raise Exception(f"Could not find reprojection error data file in path {str(data_folder_name)}")
+
+
+if __name__ == "__main__":
+ sample_data_path = load_sample_data()
+ print(f"Sample data downloaded successfully to path: {str(sample_data_path)}")
diff --git a/freemocap/tests/utilities/process_recording_headless.py b/freemocap/tests/utilities/process_recording_headless.py
index 046598ab..56ebfbd4 100644
--- a/freemocap/tests/utilities/process_recording_headless.py
+++ b/freemocap/tests/utilities/process_recording_headless.py
@@ -1,8 +1,10 @@
import logging
from pathlib import Path
from typing import Optional, Union
+
from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender import export_to_blender
+from freemocap.export_data.blender_stuff.export_to_blender import export_to_blender
+from freemocap.export_data.generate_jupyter_notebook.generate_jupyter_notebook import generate_jupyter_notebook
from freemocap.parameter_info_models.recording_info_model import RecordingInfoModel
from freemocap.parameter_info_models.recording_processing_parameter_models import RecordingProcessingParameterModel
from freemocap.system.paths_and_files_names import get_blender_file_path
@@ -11,21 +13,34 @@ logger = logging.getLogger(__name__)
def process_recording_headless(
- recording_path: Union[str, Path],
- path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
- path_to_blender_executable: Optional[Union[str, Path]] = None,
+ recording_path: Union[str, Path],
+ path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
+ path_to_blender_executable: Optional[Union[str, Path]] = None,
+ recording_processing_parameter_model: Optional[
+ RecordingProcessingParameterModel] = RecordingProcessingParameterModel(),
):
- rec = RecordingProcessingParameterModel()
+ rec = recording_processing_parameter_model
+
+ logger.info(f"Processing recording:\n"
+ f"Recording path: {recording_path}\n"
+ f"Camera calibration toml path: {path_to_camera_calibration_toml}\n"
+ f"Blender executable path: {path_to_blender_executable}\n"
+ f"Recording processing parameter model: {rec.dict()}")
rec.recording_info_model = RecordingInfoModel(recording_folder_path=Path(recording_path))
if path_to_camera_calibration_toml:
rec.recording_info_model.calibration_toml_path = Path(path_to_camera_calibration_toml)
else:
+ # TODO - Check if there are more than one video in the sync folder and if so, raise an error
logger.warning("No camera calibration toml file provided. May cause an error with multicamera recordings.")
+ logger.info("Starting core processing pipeline...")
process_recording_folder(recording_processing_parameter_model=rec)
+ logger.info("Generating jupyter notebook...")
+ generate_jupyter_notebook(path_to_recording=recording_path)
+
if path_to_blender_executable:
blender_file_path = get_blender_file_path(recording_folder_path=recording_path)
logger.info(f"Exporting to {blender_file_path}")
@@ -37,10 +52,12 @@ def process_recording_headless(
else:
logger.warning("No blender executable provided. Blender file will not be exported.")
+
def find_calibration_toml_path(recording_path: Union[str, Path]) -> Path:
- for file in recording_path.glob('*calibration.toml'):
+ for file in Path(recording_path).glob('*calibration.toml'):
return Path(file)
+
if __name__ == "__main__":
recording_path = Path("PATH/TO/RECORDING/FOLDER")
blender_path = Path("PATH/TO/BLENDER/EXECUTABLE")
diff --git a/pyproject.toml b/pyproject.toml
index 6f8bf0dd..43c71e93 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -76,6 +76,9 @@ dependencies = [
"toml",
"aniposelib",
"libsass",
+ "papermill==2.4.0",
+ "ipykernel==6.23.1",
+ "plotly==5.14.1"
]
requires-python = ">=3.8"