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 fiftyone as fo | |
import fiftyone.utils.cvat as fouc | |
dataset = fo.Dataset("my-dataset") | |
fouc.import_annotations( | |
dataset, | |
task_ids=[...], | |
download_media=True, | |
) |
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
view = dataset.match( | |
F("ground_truth.detections") | |
.filter(F("condition") == True) | |
.length() > 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
for batch in range(0, len(dataset), batch_size): | |
view = dataset[batch*batch_size : (batch+1) * batch_size] | |
results = view.annotate(..., backend="labelstudio", project_name="my_project") |
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
mean_agg = fo.Mean("predictions.detections.confidence") | |
mean_value1 = dataset1.aggregate(mean) | |
mean_value2 = dataset2.aggregate(mean) |
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
# will count the number of samples in a dataset | |
sample_count = fo.Count() | |
# will retrieve the distinct labels in the `ground_truth` field | |
distinct_labels = fo.Distinct("ground_truth.detections.label") | |
# will compute a histogram of the `uniqueness` field | |
histogram_values = fo.HistogramValues("uniqueness") | |
# efficiently compute all three results |
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
## Option 1 | |
aggregation = fo.Mean(F("predictions.detections.confidence") ** 2) | |
squared_conf_mean = dataset.aggregate(aggregation) | |
## Option 2 | |
squared_conf_mean = dataset.mean(F("predictions.detections.confidence") ** 2)) |
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
results = dataset.evaluate_detections( | |
"predictions", | |
gt_field="ground_truth", | |
eval_key="eval", | |
compute_mAP=True, | |
) | |
# Get the 10 most common classes in the dataset | |
counts = dataset.count_values("ground_truth.detections.label") | |
classes_top10 = sorted(counts, key=counts.get, reverse=True)[:10] |
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
results = dataset.evaluate_classifications( | |
"predictions", | |
gt_field="ground_truth", | |
eval_key="eval", | |
method="binary", | |
classes=["classA", "classB"], | |
) | |
results.print_report() |
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
pred_conf_field = "predictions.detections.confidence" | |
pred_confs_jagged = dataset.values(pred_conf_field) |
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
pred_conf_field = "predictions.detections.confidence" | |
pred_confs = dataset.values(pred_conf_field, unwind=True) |
OlderNewer