Skip to content

Instantly share code, notes, and snippets.

View tarlen5's full-sized avatar

Timothy Arlen tarlen5

View GitHub Profile
@tarlen5
tarlen5 / test_cf.py
Last active May 14, 2021 17:24
Cloud Function Accessing ObjectId of Pubsub Notification
def run(event, context):
"""
Sample code of a cloud function entrypoint that is called when a message
is published to a topic. This is run when there is a notification on a prefix
in cloud storage.
The message (event) contains the path to the objectId invoking the message.
"""
event_filename = event["attributes"]["objectId"]
@tarlen5
tarlen5 / create_notification.sh
Created May 14, 2021 15:56
pubsub notification using gsutil
BUCKET="gs://<your-bucket-name>"
TOPIC="projects/<your-project-id>/topics/<your-topic>"
PREFIX="your-prefix-path"
gsutil notification create \
-f json \
-t $TOPIC \
-e OBJECT_FINALIZE \
-p $PREFIX \
$BUCKET
@tarlen5
tarlen5 / calculate_mean_ap.py
Last active November 6, 2024 19:45
Calculate mean Average Precision (mAP) for a set of ground truth and predicted bounding boxes for a set of images.
"""
author: Timothy C. Arlen
date: 28 Feb 2018
Calculate Mean Average Precision (mAP) for a set of bounding boxes corresponding to specific
image Ids. Usage:
> python calculate_mean_ap.py
Will display a plot of precision vs recall curves at 10 distinct IoU thresholds as well as output