Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Advitya17 committed Mar 12, 2024
1 parent bdb59ca commit 5c6a46b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion responsibleai_vision/tests/test_feature_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

MEAN_PIXEL_VALUE = ExtractedFeatures.MEAN_PIXEL_VALUE.value
FRIDGE_METADATA_FEATURES = ['FlashPixVersion', 'WhiteBalance', 'Make', 'ExifImageHeight', 'ExposureProgram', 'Software', 'CustomRendered', 'Contrast', 'XResolution', 'GPSTimeStamp', 'Orientation', 'SubjectDistanceRange', 'MakerNote', 'SubsecTimeDigitized', 'ExifInteroperabilityOffset', 'ColorSpace', 'BrightnessValue', 'ExifImageWidth', 'SubsecTimeOriginal', 'YCbCrPositioning', 'ISOSpeedRatings', 'SubsecTime', 'ExposureBiasValue', 'ComponentsConfiguration', 'ResolutionUnit', 'ImageLength', 'GPSLatitudeRef', 'ExifVersion', 'Flash', 'ExposureMode', 'ApertureValue', 'GPSDOP', 'ImageWidth', 'SubjectDistance', 'GPSLongitudeRef', 'FNumber', 'DigitalZoomRatio', 'FocalLength', 'SceneCaptureType', 'FocalLengthIn35mmFilm', 'ShutterSpeedValue', 'DateTimeOriginal', 'Sharpness', 'GPSAltitude', 'GPSLatitude', 'Saturation', 'ExposureTime', 'GPSLongitude', 'SceneType', 'GPSDateStamp', 'GPSVersionID', 'GPSAltitudeRef', 'YResolution', 'GPSProcessingMethod', 'DateTime', 'MeteringMode', 'SensingMethod', 'DateTimeDigitized', 'Model', 'MaxApertureValue']
CLEARSIGHT_METADATA_FEATURES = ['FocalLength', 'Make', 'OffsetTimeOriginal', 'FocalPlaneYResolution', 'ExposureMode', 'LensSerialNumber', 'ApertureValue', 'GPSLatitudeRef', 'DateTimeDigitized', 'Orientation', 'OffsetTime', 'FocalPlaneResolutionUnit', 'ExposureProgram', 'ComponentsConfiguration', 'Flash', 'BodySerialNumber', 'SubsecTimeDigitized', 'CameraOwnerName', 'SubsecTime', 'ExifInteroperabilityOffset', 'ExposureBiasValue', 'ISOSpeedRatings', 'SubsecTimeOriginal', 'FNumber', 'WhiteBalance', 'GPSLatitude', 'XResolution', 'GPSSatellites', 'ShutterSpeedValue', 'GPSLongitudeRef', 'ExposureTime', 'DigitalZoomRatio', 'MeteringMode', 'ExifImageHeight', 'GPSTimeStamp', 'LensSpecification', 'Artist', 'FlashPixVersion', 'YCbCrPositioning', 'SceneCaptureType', 'DateTime', 'LensModel', 'OffsetTimeDigitized', 'GPSStatus', 'CustomRendered', 'GPSVersionID', 'SensitivityType', 'DateTimeOriginal', 'Copyright', 'ColorSpace', 'RecommendedExposureIndex', 'ResolutionUnit', 'GPSAltitude', 'Model', 'YResolution', 'ExifVersion', 'UserComment', 'FocalPlaneXResolution', 'GPSAltitudeRef', 'MakerNote', 'GPSMapDatum', 'GPSLongitude', 'GPSDateStamp', 'ExifImageWidth']


def validate_extracted_features(extracted_features, feature_names,
Expand Down Expand Up @@ -86,7 +87,7 @@ def test_extract_features_clearsight_metadata(self):
extracted_features, feature_names = extract_dataset_features(
data, feature_metadata=feature_metadata)
expected_feature_names = [MEAN_PIXEL_VALUE]
expected_feature_names += FRIDGE_METADATA_FEATURES
expected_feature_names += CLEARSIGHT_METADATA_FEATURES
validate_extracted_features(extracted_features, feature_names,
expected_feature_names, data,
feature_metadata)
7 changes: 6 additions & 1 deletion responsibleai_vision/tests/test_image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from urllib.parse import urlparse

import numpy as np
from common_vision_utils import load_fridge_object_detection_dataset
from common_vision_utils import load_clearsight_object_detection_dataset, load_fridge_object_detection_dataset

from responsibleai_vision.common.constants import ImageColumns
from responsibleai_vision.utils.image_reader import \
Expand Down Expand Up @@ -98,6 +98,11 @@ def test_get_all_exif_feature_names(self):
exif_feature_names = get_all_exif_feature_names(image_dataset)
assert len(exif_feature_names) == 60

def test_get_all_clearsight_feature_names(self):
image_dataset = load_clearsight_object_detection_dataset().head(2)
exif_feature_names = get_all_exif_feature_names(image_dataset)
assert len(exif_feature_names) == 64

def test_generate_od_error_labels(self):
true_y = np.array([[[3, 142, 257, 395, 463, 0]],
[[3, 107, 272, 240, 501, 0],
Expand Down

0 comments on commit 5c6a46b

Please sign in to comment.