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
"""This module implements cycle consistent matching using pairs of views.""" | |
from __future__ import annotations | |
from typing import Generator | |
import cv2 | |
import matplotlib.patches as patches | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import seaborn as sns |
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
"""Outline number of labeled frames, recording sessions, and video paths for all SLPs in directory. | |
This script recursively finds SLP files in a directory and outputs a CSV outlining how many labeled frames, recording | |
sessions, and videos there are in each slp project within a directory. | |
""" | |
import pathlib | |
import pandas as pd |
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
"""Script to find when an annotation is in a ROI of a given image. | |
# Installation | |
```bash | |
conda create -c conda-forge sleap-io shapely -n sio | |
``` | |
# Usage | |
Make changes to the __main__ block at the bottom of the file. Then activate the | |
environment and run the script. |
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
import numpy as np | |
import pandas as pd | |
import shapely | |
import sleap_io as sio | |
from shapely import Polygon | |
from sleap_io import Instance, Labels, LabeledFrame, PredictedInstance, Track | |
def load_rfid_rois(ds_rfid: str): | |
"""Load a dictionary of RFID ROI `Polygons`. |
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
"""This script creates a Labels object from a list of mp4 files in a directory.""" | |
from __future__ import annotations # Import future annotations | |
from pathlib import Path | |
from sleap import Labels, Video | |
def find_videos_in_directory(directory: str, video_ext: str = None) -> list[str]: | |
"""Find all video files in a directory. |
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
import h5py | |
import logging | |
import os | |
import numpy as np | |
from sleap_anipose import triangulate | |
import sleap | |
from sleap.io.cameras import RecordingSession, FrameGroup | |
from sleap.gui.commands import TriangulateSession |
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
from __future__ import annotations | |
import logging | |
import os | |
from datetime import datetime | |
from pathlib import Path | |
# TODO: Install these dependencies (and PySide6) | |
import cv2 | |
import h5py |
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
import sleap | |
from sleap import Track | |
from sleap.gui.app import main as sleap_label | |
def main(ds: str, ds_output: str, midpoint:float = 0.5): | |
"""Reassigns tracks based on x-threshold and saves to `ds_output`. | |
Note: This function assumes that the dataset has only two animals. No restrictions | |
are in place to ensure that two animals in the same frame are assigned different | |
tracks. This is a simple example to demonstrate how to reassign tracks based on |
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
"""Converts the "py/state" entries in a JSON file to contain "py/tuple" entries. | |
SLEAP uses jsonpickle to encode/decode `Skeleton` objects to/from JSON. When a Python | |
object is encoded to JSON, the "py/state" key is used to store the object's state. | |
jsonpickle relies on the object's `__getstate__` method to determine the state to store. | |
attr creates a `__getstate__` method for the object. However, in `attr>=22.2.0`, the | |
formatting changes s.t. `__getstate__` returns a dictionary of the object's attributes | |
instead of a tuple. This causes problems when decoding the JSON back to a Python object | |
if the system has an older version of `attr<22.2.0`. |
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
import google.auth | |
# TODO: pip install pandas | |
import pandas as pd | |
# TODO: pip install google-cloud-billing | |
from google.cloud import billing_v1 | |
def list_services(): |
NewerOlder