Package: wf-process-cuwb-data
process_cuwb_dataTools for reading, processing, and writing CUWB dataSetupThis project uses Poetry. Please make sure Poetry is installed before continuing.Copy.env.templateto.envand update variablesInstall packagesjust installYou may need to install pybind11brew install pybind11And you may need to manually install cython and numpypip install numpy cython pythranTasksExport pickled UWB dataWorking with Honeycomb's UWB endpoint can be painfully slow. For that reason there is an option to export pickled UWB data and provide that to subsequent inference commands.process_cuwb_data \
    fetch-cuwb-data \
    --environment greenbrier \
    --start 2021-04-20T9:00:00-0500 \
    --end 2021-04-20T9:05:00-0500 \
    --annonymizeExport pickled Motion Feature dataThe tray carry model doesn't read raw UWB data. It reads a version of UWB data that has been prepared for inference. This feature data can be generated and fed into subsequent commands.process_cuwb_data \
    fetch-motion-features \
    --environment greenbrier \
    --start 2021-05-27T14:13:00 \
    --end 2021-05-27T14:15:00 \
    --cuwb-data ./output/uwb_data/uwb-greenbrier-20210527-141300-20210527-141500.pkl \
    --annonymizeGenerate Tray CentroidsTray centroids, or tray positions, are the most likely locations of a tray's shelf or at-rest position. Tray locations are used, for example, to determine when someone is picking a tray up off the shelf as opposed to picking up a tray from a workstation. Note that tray locations are computed based on the window of time provided to the function. If the function ran on 10 minutes of classroom data, it'd likely produce a different idea of tray's shelf locations than if the function was run on 9 hours of classroom activity.process_cuwb_data \
    estimate-tray-centroids \
    --environment dahlia \
    --start 2023-01-06T07:30:00-0800 \
    --end 2023-01-06T17:00:00-0800 \
    --cuwb-data ./output/uwb_data/uwb-dahlia-20230106-153000-20230107-010000.pkl \
    --tray-carry-model ./output/models/tray_carry_model_v2.pklTrain Tray Detection ModelThe tray detection model is a simple RandomForest model. It's used by many of the available methods in the library.Download/createground_truth_tray_carry.csvto./downloads/ground_truth_tray_carry.csvcurl -L 'https://docs.google.com/spreadsheets/d/1NLQ_7Cj432T1AXFcbKLX3P6LGGGRAklxMTjtBYS_xhA/export?exportFormat=csv' --output ./downloads/ground_truth_tray_carry.csvGenerate pickled groundtruth features dataframe from ground_truth_tray_carry.csvThis will download data from Honeycomb and prepare it for the next step of feeding it into a model for training.process_cuwb_data \
        generate-tray-carry-groundtruth \
        --groundtruth-csv ./downloads/ground_truth_tray_carry.csvTrain and pickle Tray Carry Detection Model using pickled groundtruth featuresprocess_cuwb_data \
        train-tray-carry-model \
        --groundtruth-features ./output/groundtruth/2021-05-13T12:53:26_tray_carry_groundtruth_features.pklInfer Tray CarriesInfer Tray Interactions using a pickled Tray Carry Detection ModelUse the model you've trained by following the steps toTrain Tray Detection ModelOr, download the latest model:curl -L 'https://drive.google.com/uc?export=download&id=1U3QV5TNZCs_GF-L2GO8t-h-BeJs7cCph' --output ./output/models/tray_carry_model_v2.pklInfer Tray InteractionThis outputs a list of tray carries (CARRY FROM SHELF / CARRY TO SHELF / CARRY UNKNOWN / etc.) and describe the person, the material, the length of the carry, and median distance between the nearest person and tray over the course of the eventprocess_cuwb_data \
     infer-tray-interactions \
     --environment greenbrier \
     --start 2021-04-20T9:00:00-0500 \
     --end 2021-04-20T9:05:00-0500 \
     --tray-carry-model ./output/models/2021-05-13T14:49:32_tray_carry_model.pkl \
     --cuwb-data ./output/uwb_data/uwb-greenbrier-20210420-140000-20210420-140500.pkl
    
(or, instead of --cuwb-datam, use) --motion-feature-data ./output/feature_data/motion-features-greenbrier-20210527-141300-20210527-141500.pkl
(optionally, supply tray positions/centroids. Note, these locations should ALWAYS be provided if attempting to infer tray interactions on a partial window of classroom time.) --tray-positions-csv ./output/locations/2023-01-19T15:57:12_tray_centroids.csvSupply Pose Track Inference to Tray Interaction InferenceUse Pose Tracks when determining nearest person to tray carry events.Pose Inferences need to be sourced in a local directory. The pose directory can be supplied via CLI options.process_cuwb_data \
     infer-tray-interactions \
     --environment greenbrier \
     --start 2021-04-20T9:00:00-0500 \
     --end 2021-04-20T9:05:00-0500 \
     --tray-carry-model ./output/models/2021-05-13T14:49:32_tray_carry_model.pkl \
     --cuwb-data ./output/uwb_data/uwb-greenbrier-20210420-140000-20210420-140500.pkl \
     --pose-inference-id 3c2cca86ceac4ab1b13f9f7bfed7834eInfer Tray EventsThis is a more standardized version/output of Tray Interactions. It's the format used by the Material Events API. It's input includes the TrayInteractions CSV fromInfer Tray InteractionNote,time_zoneis a required parameter. It's used to construct strings with times that will be read by end users. We will not default this to timezone that may be invalid.process_cuwb_data \
     infer-tray-events \
     --environment dahliasf \
     --tray-interactions ./output/inference/tray_interactions/2023-01-23T15:28:30_tray_interactions.csv \
     --time_zone US/PacificInfer Material EventsThis generates a list of "complete" material events. A complete material event starts with a Carry From Shelf and ends with a Carry To Shelf. The Material Events output also includes a list of cameras that best capture the arc of the material event.Note,time_zoneis a required parameter. It's used to construct strings with times that will be read by end users. We will not default this to timezone that may be invalid.process_cuwb_data \
     infer-material-events \
     --environment dahliasf \
     --tray-events ./output/inference/tray_events/2023-01-23T22:05:02_tray_events.csv \
     --timezone US/Pacific