Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update icon and title audio classification #38

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
BF5A2B322BC3D40C00A0ABAC /* DefaultConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5A2B312BC3D40C00A0ABAC /* DefaultConstants.swift */; };
BF871AE42C9D306000299B0E /* AudioInputManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF871AE32C9D306000299B0E /* AudioInputManager.swift */; };
BF871AE72C9D327500299B0E /* yamnet_label_list.txt in Resources */ = {isa = PBXBuildFile; fileRef = BF871AE52C9D327500299B0E /* yamnet_label_list.txt */; };
BF871AE82C9D327500299B0E /* probability_labels.txt in Resources */ = {isa = PBXBuildFile; fileRef = BF871AE62C9D327500299B0E /* probability_labels.txt */; };
BFB819572BD755B200C71A36 /* yamnet.tflite in Resources */ = {isa = PBXBuildFile; fileRef = BFB819552BD755B200C71A36 /* yamnet.tflite */; };
BFB819582BD755B200C71A36 /* speech_commands.tflite in Resources */ = {isa = PBXBuildFile; fileRef = BFB819562BD755B200C71A36 /* speech_commands.tflite */; };
DC1E75C4F2AD273C59E6B96C /* Pods_AudioClassification.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7EFDE0C16196D1BDC31A015 /* Pods_AudioClassification.framework */; };
Expand All @@ -42,7 +41,6 @@
BF5A2B312BC3D40C00A0ABAC /* DefaultConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultConstants.swift; sourceTree = "<group>"; };
BF871AE32C9D306000299B0E /* AudioInputManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioInputManager.swift; sourceTree = "<group>"; };
BF871AE52C9D327500299B0E /* yamnet_label_list.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = yamnet_label_list.txt; sourceTree = "<group>"; };
BF871AE62C9D327500299B0E /* probability_labels.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = probability_labels.txt; sourceTree = "<group>"; };
BFB819552BD755B200C71A36 /* yamnet.tflite */ = {isa = PBXFileReference; lastKnownFileType = file; path = yamnet.tflite; sourceTree = "<group>"; };
BFB819562BD755B200C71A36 /* speech_commands.tflite */ = {isa = PBXFileReference; lastKnownFileType = file; path = speech_commands.tflite; sourceTree = "<group>"; };
D0B6F76E4B8425E1C75565D4 /* Pods_AudioClassificationTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AudioClassificationTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -112,7 +110,6 @@
BF5A2B262BC3CFD800A0ABAC /* Services */ = {
isa = PBXGroup;
children = (
BF871AE62C9D327500299B0E /* probability_labels.txt */,
BF871AE52C9D327500299B0E /* yamnet_label_list.txt */,
BFB819562BD755B200C71A36 /* speech_commands.tflite */,
BFB819552BD755B200C71A36 /* yamnet.tflite */,
Expand Down Expand Up @@ -218,7 +215,6 @@
buildActionMask = 2147483647;
files = (
BF5A2AFD2BC3CE0200A0ABAC /* Assets.xcassets in Resources */,
BF871AE82C9D327500299B0E /* probability_labels.txt in Resources */,
BFB819582BD755B200C71A36 /* speech_commands.tflite in Resources */,
BFB819572BD755B200C71A36 /* yamnet.tflite in Resources */,
BF871AE72C9D327500299B0E /* yamnet_label_list.txt in Resources */,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "100.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<action selector="showHidenButtonTouchUpInside:" destination="iph-Fi-onr" eventType="touchUpInside" id="46E-6m-MbN"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" showsMenuAsPrimaryAction="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NhR-Jw-fCt">
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" showsMenuAsPrimaryAction="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NhR-Jw-fCt">
<rect key="frame" x="261" y="90.333333333333371" width="94" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="34" id="39y-ec-FSs"/>
Expand Down Expand Up @@ -261,25 +261,47 @@
<outlet property="thresholdStepper" destination="0aJ-B4-Rqn" id="aYc-iY-l3I"/>
</connections>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LiteRT_Logo" translatesAutoresizingMaskIntoConstraints="NO" id="7K0-XB-7ff">
<rect key="frame" x="0.0" y="50" width="375" height="44"/>
<color key="backgroundColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="0.47696109693877553" colorSpace="custom" customColorSpace="calibratedRGB"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AWd-2C-IAg">
<rect key="frame" x="89.666666666666671" y="50" width="195.66666666666663" height="44"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="eYN-BH-JkL">
<rect key="frame" x="0.0" y="7" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="AEz-jU-C2r"/>
<constraint firstAttribute="width" constant="30" id="K1K-eR-IyX"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Audio Classification" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PKG-nt-rOz">
<rect key="frame" x="34" y="0.0" width="161.66666666666666" height="44"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="PKG-nt-rOz" firstAttribute="top" secondItem="AWd-2C-IAg" secondAttribute="top" id="AGQ-HB-Jsv"/>
<constraint firstAttribute="bottom" secondItem="PKG-nt-rOz" secondAttribute="bottom" id="IAh-NK-SD6"/>
<constraint firstAttribute="trailing" secondItem="PKG-nt-rOz" secondAttribute="trailing" id="O2j-Eq-a1P"/>
<constraint firstItem="eYN-BH-JkL" firstAttribute="leading" secondItem="AWd-2C-IAg" secondAttribute="leading" id="kDO-ak-KCL"/>
<constraint firstItem="eYN-BH-JkL" firstAttribute="centerY" secondItem="AWd-2C-IAg" secondAttribute="centerY" id="mJE-UA-UW7"/>
<constraint firstItem="PKG-nt-rOz" firstAttribute="leading" secondItem="eYN-BH-JkL" secondAttribute="trailing" constant="4" id="rbe-Fq-gBB"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="iph-Fi-onr" firstAttribute="trailing" secondItem="6Tk-OE-BBY" secondAttribute="trailing" id="9TG-hq-iy2"/>
<constraint firstItem="AWd-2C-IAg" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="Alf-Ls-TEW"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="MEL-oY-YWf" secondAttribute="bottom" id="K0l-3h-XqO"/>
<constraint firstItem="7K0-XB-7ff" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="Ozd-1O-mDX"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="7K0-XB-7ff" secondAttribute="trailing" id="TeZ-ak-i36"/>
<constraint firstItem="MEL-oY-YWf" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="Ysz-tc-eCZ"/>
<constraint firstItem="7K0-XB-7ff" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="ab3-mA-0MS"/>
<constraint firstItem="MEL-oY-YWf" firstAttribute="top" secondItem="7K0-XB-7ff" secondAttribute="bottom" id="gqd-2U-IzF"/>
<constraint firstItem="AWd-2C-IAg" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="a6C-35-Nat"/>
<constraint firstItem="iph-Fi-onr" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="hbf-z3-Acp"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="MEL-oY-YWf" secondAttribute="trailing" id="hxW-Ew-mqA"/>
<constraint firstItem="MEL-oY-YWf" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="44" id="wHm-6a-m6s"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="iph-Fi-onr" secondAttribute="bottom" id="wIl-Ag-dMb"/>
<constraint firstItem="MEL-oY-YWf" firstAttribute="top" secondItem="AWd-2C-IAg" secondAttribute="bottom" id="wac-If-CqV"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
Expand All @@ -294,9 +316,9 @@
</scene>
</scenes>
<resources>
<image name="LiteRT_Logo" width="1333.3333740234375" height="555.66668701171875"/>
<image name="icn_chevron_down" width="48" height="48"/>
<image name="icn_chevron_up" width="48" height="48"/>
<image name="logo" width="33.333332061767578" height="33.333332061767578"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ import Foundation

enum Model: String, CaseIterable {
case Yamnet = "YAMNet"
case speechCommand = "Speech Command"

var modelPath: String? {
switch self {
case .Yamnet:
return Bundle.main.path(
forResource: "yamnet", ofType: "tflite")
case .speechCommand:
return Bundle.main.path(
forResource: "speech_commands", ofType: "tflite")
}
}

Expand All @@ -35,17 +31,14 @@ enum Model: String, CaseIterable {
case .Yamnet:
return Bundle.main.path(
forResource: "yamnet_label_list", ofType: "txt")
case .speechCommand:
return Bundle.main.path(
forResource: "probability_labels", ofType: "txt")
}
}
}


struct DefaultConstants {
static var model: Model = .Yamnet
static var overLap: Double = 0.5
static var overLap: Double = 0.2
static var maxResults: Int = 3
static var threshold: Float = 0.3
static var threadCount: Int = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class AudioClassificationHelper {
switch model {
case .Yamnet:
sampleRate = inputShape.dimensions[0]
case .speechCommand:
sampleRate = inputShape.dimensions[1]
}
try interpreter.invoke()
} catch {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,3 @@ else
curl -o ${TFLITE_FILE} https://storage.googleapis.com/ai-edge/interpreter-samples/audio_classification/ios/yamnet.tflite
echo "INFO: Downloaded yamnet.tflite to $TFLITE_FILE ."
fi

# Download speech_commands.tflite from the internet if it's not exist.
TFLITE_FILE=./AudioClassification/Services/speech_commands.tflite
if test -f "$TFLITE_FILE"; then
echo "INFO: speech_commands.tflite existed. Skip downloading and use the local model."
else
curl -o ${TFLITE_FILE} https://storage.googleapis.com/ai-edge/interpreter-samples/audio_classification/ios/speech_commands.tflite
echo "INFO: Downloaded speech_commands.tflite to $TFLITE_FILE ."
fi