commit ba3ba38fc9a586a4e55c1b8d4ed2c23d034c2321 Author: vl.arkhangelskii Date: Sun Sep 27 19:12:14 2026 +0300 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3527c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +# Dataset download, training runs, and local Python env +/data/ +/runs/ +/.venv/ + +# Widget Preview related +.widget_preview/ diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..0c146c2 --- /dev/null +++ b/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "6a19cca56475dbfba1478ee68d7bd0c2ef891da1" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 6a19cca56475dbfba1478ee68d7bd0c2ef891da1 + base_revision: 6a19cca56475dbfba1478ee68d7bd0c2ef891da1 + - platform: android + create_revision: 6a19cca56475dbfba1478ee68d7bd0c2ef891da1 + base_revision: 6a19cca56475dbfba1478ee68d7bd0c2ef891da1 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ChatGPT Image 27 сент. 2026 г., 16_19_48.png b/ChatGPT Image 27 сент. 2026 г., 16_19_48.png new file mode 100644 index 0000000..e8b3a4b Binary files /dev/null and b/ChatGPT Image 27 сент. 2026 г., 16_19_48.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..3d574c1 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# sign_checker + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter) +- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..ae2e3ea --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,33 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +analyzer: + exclude: + - build/** + - android/** + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..55abc02 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,50 @@ +plugins { + id("com.android.application") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.signchecker.sign_checker" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + androidResources { + noCompress += listOf("tflite", "lite") + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + applicationId = "com.signchecker.sign_checker" + minSdk = maxOf(flutter.minSdkVersion, 24) + targetSdk = flutter.targetSdkVersion + // Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION + // is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions) + // You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true` + // flag during build. + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a4e3536 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/signchecker/sign_checker/MainActivity.kt b/android/app/src/main/kotlin/com/signchecker/sign_checker/MainActivity.kt new file mode 100644 index 0000000..d858670 --- /dev/null +++ b/android/app/src/main/kotlin/com/signchecker/sign_checker/MainActivity.kt @@ -0,0 +1,5 @@ +package com.signchecker.sign_checker + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..8a8f9ac Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..6c261cd Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..eb36354 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..40e8063 Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..e319f4c Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..0dd8713 Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..eb36354 --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..c0be12a --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..961c554 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..f7aaaaa Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71cf3ca Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8eb8654 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..385d16d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..ad9bbb7 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #10141A + #10141A + \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..fadfa73 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,44 @@ +import com.android.build.gradle.BaseExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) + + // tflite_flutter compiles Java as 11 and leaves Kotlin on the toolchain + // default (25 with Kotlin 2.4). Align both before evaluationDependsOn + // forces projects to evaluate. + afterEvaluate { + if (name == "app") { + return@afterEvaluate + } + extensions.findByType(BaseExtension::class.java)?.compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + tasks.withType().configureEach { + compilerOptions.jvmTarget.set(JvmTarget.JVM_17) + } + } +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html new file mode 100644 index 0000000..44d8115 --- /dev/null +++ b/android/build/reports/problems/problems-report.html @@ -0,0 +1,659 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..e96108c --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a20f2c4 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..b28021a --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.1.0" apply false + id("org.jetbrains.kotlin.android") version "2.4.0" apply false +} + +include(":app") diff --git a/assets/branding/app_icon.png b/assets/branding/app_icon.png new file mode 100644 index 0000000..200ada6 Binary files /dev/null and b/assets/branding/app_icon.png differ diff --git a/assets/models/labels.txt b/assets/models/labels.txt new file mode 100644 index 0000000..1bd83cb --- /dev/null +++ b/assets/models/labels.txt @@ -0,0 +1,90 @@ +redyellowTrafficLights +5.19.2 +yellowTrafficLights +3.27 +redTrafficLights +5.16 +TrafficLights +greenTrafficLights +3.24.1 +3.1 +5.19.1 +2.3.1 +3.24.7 +3.21 +4.1.5 +2.1 +3.24.10 +3.20 +3.24.9 +2.4 +5.7.1 +6.16 +3.31 +1.22 +5.6 +6.4 +2.6 +3.24.4 +3.24.2 +1.34.2 +1.17 +5.20 +1.23 +4.2.1 +8.22.1 +4.1.1 +6.3.1 +7.3 +6.7 +4.1.4 +3.18.1 +4.1.2 +2.5 +4.2.3 +8.22.3 +3.24.6 +3.24.8 +3.2 +1.31 +2.2 +4.1.3 +1.11.1 +3.24.3 +5.5 +4.3 +3.24.5 +2.7 +3.36 +3.28 +1.33 +1.1 +4.1.6 +2.3 +7.4 +8.5.4 +5.1 +5.14 +6.3.2 +1.8 +6.8.3 +1.6 +3.24.11 +8.2.1 +7.5 +3.13.35 +1.12.2 +1.27 +1.12 +1.15 +1.26 +1.19 +2.3.2 +2.3.3 +3.24 +8.13 +4.2.2 +1.25 +3.25 +8.1.1 +6.6 diff --git a/assets/models/signs.tflite b/assets/models/signs.tflite new file mode 100644 index 0000000..cc9ad24 Binary files /dev/null and b/assets/models/signs.tflite differ diff --git a/assets/signs/1.1.svg b/assets/signs/1.1.svg new file mode 100644 index 0000000..30aef54 --- /dev/null +++ b/assets/signs/1.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.10.svg b/assets/signs/1.10.svg new file mode 100644 index 0000000..c861071 --- /dev/null +++ b/assets/signs/1.10.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.11.1.svg b/assets/signs/1.11.1.svg new file mode 100644 index 0000000..c279e35 --- /dev/null +++ b/assets/signs/1.11.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.11.2.svg b/assets/signs/1.11.2.svg new file mode 100644 index 0000000..618e286 --- /dev/null +++ b/assets/signs/1.11.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.12.1.svg b/assets/signs/1.12.1.svg new file mode 100644 index 0000000..e68664e --- /dev/null +++ b/assets/signs/1.12.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.12.2.svg b/assets/signs/1.12.2.svg new file mode 100644 index 0000000..a16df26 --- /dev/null +++ b/assets/signs/1.12.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.13.svg b/assets/signs/1.13.svg new file mode 100644 index 0000000..c5c1da7 --- /dev/null +++ b/assets/signs/1.13.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.14.svg b/assets/signs/1.14.svg new file mode 100644 index 0000000..5f2685c --- /dev/null +++ b/assets/signs/1.14.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.15.svg b/assets/signs/1.15.svg new file mode 100644 index 0000000..12cfb62 --- /dev/null +++ b/assets/signs/1.15.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.16.svg b/assets/signs/1.16.svg new file mode 100644 index 0000000..479a37d --- /dev/null +++ b/assets/signs/1.16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.17.svg b/assets/signs/1.17.svg new file mode 100644 index 0000000..f196100 --- /dev/null +++ b/assets/signs/1.17.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.18.svg b/assets/signs/1.18.svg new file mode 100644 index 0000000..e8ee761 --- /dev/null +++ b/assets/signs/1.18.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.19.svg b/assets/signs/1.19.svg new file mode 100644 index 0000000..2728246 --- /dev/null +++ b/assets/signs/1.19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.2.svg b/assets/signs/1.2.svg new file mode 100644 index 0000000..fd2fd13 --- /dev/null +++ b/assets/signs/1.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.20.1.svg b/assets/signs/1.20.1.svg new file mode 100644 index 0000000..2a04301 --- /dev/null +++ b/assets/signs/1.20.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.20.2.svg b/assets/signs/1.20.2.svg new file mode 100644 index 0000000..7adb7a8 --- /dev/null +++ b/assets/signs/1.20.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.20.3.svg b/assets/signs/1.20.3.svg new file mode 100644 index 0000000..3b4a271 --- /dev/null +++ b/assets/signs/1.20.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.21.svg b/assets/signs/1.21.svg new file mode 100644 index 0000000..6e3ccbd --- /dev/null +++ b/assets/signs/1.21.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.22.svg b/assets/signs/1.22.svg new file mode 100644 index 0000000..8971b5a --- /dev/null +++ b/assets/signs/1.22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.23.svg b/assets/signs/1.23.svg new file mode 100644 index 0000000..1c881bf --- /dev/null +++ b/assets/signs/1.23.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.24.svg b/assets/signs/1.24.svg new file mode 100644 index 0000000..5de2571 --- /dev/null +++ b/assets/signs/1.24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.25.svg b/assets/signs/1.25.svg new file mode 100644 index 0000000..c7af2de --- /dev/null +++ b/assets/signs/1.25.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.26.svg b/assets/signs/1.26.svg new file mode 100644 index 0000000..d1c3262 --- /dev/null +++ b/assets/signs/1.26.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.27.svg b/assets/signs/1.27.svg new file mode 100644 index 0000000..09aa9e3 --- /dev/null +++ b/assets/signs/1.27.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.28.svg b/assets/signs/1.28.svg new file mode 100644 index 0000000..06879f7 --- /dev/null +++ b/assets/signs/1.28.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.29.svg b/assets/signs/1.29.svg new file mode 100644 index 0000000..e3044ae --- /dev/null +++ b/assets/signs/1.29.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.3.1.svg b/assets/signs/1.3.1.svg new file mode 100644 index 0000000..558b51a --- /dev/null +++ b/assets/signs/1.3.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.3.2.svg b/assets/signs/1.3.2.svg new file mode 100644 index 0000000..4fea8e5 --- /dev/null +++ b/assets/signs/1.3.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.30.svg b/assets/signs/1.30.svg new file mode 100644 index 0000000..2de95ef --- /dev/null +++ b/assets/signs/1.30.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.31.svg b/assets/signs/1.31.svg new file mode 100644 index 0000000..f9055ab --- /dev/null +++ b/assets/signs/1.31.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.32.svg b/assets/signs/1.32.svg new file mode 100644 index 0000000..24cfadd --- /dev/null +++ b/assets/signs/1.32.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.33.svg b/assets/signs/1.33.svg new file mode 100644 index 0000000..854cf2d --- /dev/null +++ b/assets/signs/1.33.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.34.1.svg b/assets/signs/1.34.1.svg new file mode 100644 index 0000000..14bfe4c --- /dev/null +++ b/assets/signs/1.34.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.34.2.svg b/assets/signs/1.34.2.svg new file mode 100644 index 0000000..153517c --- /dev/null +++ b/assets/signs/1.34.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.34.3.svg b/assets/signs/1.34.3.svg new file mode 100644 index 0000000..f1f44bd --- /dev/null +++ b/assets/signs/1.34.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.35.svg b/assets/signs/1.35.svg new file mode 100644 index 0000000..00c338d --- /dev/null +++ b/assets/signs/1.35.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/signs/1.4.1.svg b/assets/signs/1.4.1.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.4.2.svg b/assets/signs/1.4.2.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.4.3.svg b/assets/signs/1.4.3.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.4.4.svg b/assets/signs/1.4.4.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.4.5.svg b/assets/signs/1.4.5.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.4.6.svg b/assets/signs/1.4.6.svg new file mode 100644 index 0000000..e1ffc6f --- /dev/null +++ b/assets/signs/1.4.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.5.svg b/assets/signs/1.5.svg new file mode 100644 index 0000000..31a6e1d --- /dev/null +++ b/assets/signs/1.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.6.svg b/assets/signs/1.6.svg new file mode 100644 index 0000000..857701e --- /dev/null +++ b/assets/signs/1.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.7.svg b/assets/signs/1.7.svg new file mode 100644 index 0000000..9f2e8ba --- /dev/null +++ b/assets/signs/1.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.8.svg b/assets/signs/1.8.svg new file mode 100644 index 0000000..5d15ae4 --- /dev/null +++ b/assets/signs/1.8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/1.9.svg b/assets/signs/1.9.svg new file mode 100644 index 0000000..04506ad --- /dev/null +++ b/assets/signs/1.9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.1.svg b/assets/signs/2.1.svg new file mode 100644 index 0000000..f66aada --- /dev/null +++ b/assets/signs/2.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.2.svg b/assets/signs/2.2.svg new file mode 100644 index 0000000..6666923 --- /dev/null +++ b/assets/signs/2.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.1.svg b/assets/signs/2.3.1.svg new file mode 100644 index 0000000..a61e711 --- /dev/null +++ b/assets/signs/2.3.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.2.svg b/assets/signs/2.3.2.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.3.svg b/assets/signs/2.3.3.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.4.svg b/assets/signs/2.3.4.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.5.svg b/assets/signs/2.3.5.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.6.svg b/assets/signs/2.3.6.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.3.7.svg b/assets/signs/2.3.7.svg new file mode 100644 index 0000000..a761dc2 --- /dev/null +++ b/assets/signs/2.3.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.4.svg b/assets/signs/2.4.svg new file mode 100644 index 0000000..cf2d1bb --- /dev/null +++ b/assets/signs/2.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.5.svg b/assets/signs/2.5.svg new file mode 100644 index 0000000..785aafe --- /dev/null +++ b/assets/signs/2.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.6.svg b/assets/signs/2.6.svg new file mode 100644 index 0000000..ab826b0 --- /dev/null +++ b/assets/signs/2.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/2.7.svg b/assets/signs/2.7.svg new file mode 100644 index 0000000..7be54d9 --- /dev/null +++ b/assets/signs/2.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.1.svg b/assets/signs/3.1.svg new file mode 100644 index 0000000..017100d --- /dev/null +++ b/assets/signs/3.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.10.svg b/assets/signs/3.10.svg new file mode 100644 index 0000000..1aa9d91 --- /dev/null +++ b/assets/signs/3.10.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.11.svg b/assets/signs/3.11.svg new file mode 100644 index 0000000..396056a --- /dev/null +++ b/assets/signs/3.11.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.12.svg b/assets/signs/3.12.svg new file mode 100644 index 0000000..1b35309 --- /dev/null +++ b/assets/signs/3.12.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.13.svg b/assets/signs/3.13.svg new file mode 100644 index 0000000..2000a2f --- /dev/null +++ b/assets/signs/3.13.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.14.svg b/assets/signs/3.14.svg new file mode 100644 index 0000000..7aa6166 --- /dev/null +++ b/assets/signs/3.14.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.15.svg b/assets/signs/3.15.svg new file mode 100644 index 0000000..abb9ec6 --- /dev/null +++ b/assets/signs/3.15.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.16.svg b/assets/signs/3.16.svg new file mode 100644 index 0000000..b606237 --- /dev/null +++ b/assets/signs/3.16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.17.1.svg b/assets/signs/3.17.1.svg new file mode 100644 index 0000000..0a4948b --- /dev/null +++ b/assets/signs/3.17.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.17.2.svg b/assets/signs/3.17.2.svg new file mode 100644 index 0000000..a66ac96 --- /dev/null +++ b/assets/signs/3.17.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.17.3.svg b/assets/signs/3.17.3.svg new file mode 100644 index 0000000..c7714ad --- /dev/null +++ b/assets/signs/3.17.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.18.1.svg b/assets/signs/3.18.1.svg new file mode 100644 index 0000000..637be74 --- /dev/null +++ b/assets/signs/3.18.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.18.2.svg b/assets/signs/3.18.2.svg new file mode 100644 index 0000000..63ad828 --- /dev/null +++ b/assets/signs/3.18.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.19.svg b/assets/signs/3.19.svg new file mode 100644 index 0000000..ae00e72 --- /dev/null +++ b/assets/signs/3.19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.2.svg b/assets/signs/3.2.svg new file mode 100644 index 0000000..15aa1d9 --- /dev/null +++ b/assets/signs/3.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.20.svg b/assets/signs/3.20.svg new file mode 100644 index 0000000..eb45d78 --- /dev/null +++ b/assets/signs/3.20.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.21.svg b/assets/signs/3.21.svg new file mode 100644 index 0000000..f6d548d --- /dev/null +++ b/assets/signs/3.21.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.22.svg b/assets/signs/3.22.svg new file mode 100644 index 0000000..aa19ffe --- /dev/null +++ b/assets/signs/3.22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.23.svg b/assets/signs/3.23.svg new file mode 100644 index 0000000..ccd0c72 --- /dev/null +++ b/assets/signs/3.23.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.24.svg b/assets/signs/3.24.svg new file mode 100644 index 0000000..17c6cf5 --- /dev/null +++ b/assets/signs/3.24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.25.svg b/assets/signs/3.25.svg new file mode 100644 index 0000000..ec44d08 --- /dev/null +++ b/assets/signs/3.25.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.26.svg b/assets/signs/3.26.svg new file mode 100644 index 0000000..e51bfa3 --- /dev/null +++ b/assets/signs/3.26.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.27.svg b/assets/signs/3.27.svg new file mode 100644 index 0000000..9925592 --- /dev/null +++ b/assets/signs/3.27.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.28.svg b/assets/signs/3.28.svg new file mode 100644 index 0000000..198cdb5 --- /dev/null +++ b/assets/signs/3.28.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.29.svg b/assets/signs/3.29.svg new file mode 100644 index 0000000..49ed336 --- /dev/null +++ b/assets/signs/3.29.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.3.svg b/assets/signs/3.3.svg new file mode 100644 index 0000000..476c5c3 --- /dev/null +++ b/assets/signs/3.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.30.svg b/assets/signs/3.30.svg new file mode 100644 index 0000000..9d4ee53 --- /dev/null +++ b/assets/signs/3.30.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.31.svg b/assets/signs/3.31.svg new file mode 100644 index 0000000..498027d --- /dev/null +++ b/assets/signs/3.31.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.32.svg b/assets/signs/3.32.svg new file mode 100644 index 0000000..8c38e8c --- /dev/null +++ b/assets/signs/3.32.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.33.svg b/assets/signs/3.33.svg new file mode 100644 index 0000000..2cc017d --- /dev/null +++ b/assets/signs/3.33.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.34.svg b/assets/signs/3.34.svg new file mode 100644 index 0000000..c491942 --- /dev/null +++ b/assets/signs/3.34.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.35.svg b/assets/signs/3.35.svg new file mode 100644 index 0000000..b90b90a --- /dev/null +++ b/assets/signs/3.35.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/3.4.svg b/assets/signs/3.4.svg new file mode 100644 index 0000000..8f39034 --- /dev/null +++ b/assets/signs/3.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.5.svg b/assets/signs/3.5.svg new file mode 100644 index 0000000..797ea73 --- /dev/null +++ b/assets/signs/3.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.6.svg b/assets/signs/3.6.svg new file mode 100644 index 0000000..3b9b71b --- /dev/null +++ b/assets/signs/3.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.7.svg b/assets/signs/3.7.svg new file mode 100644 index 0000000..f52a078 --- /dev/null +++ b/assets/signs/3.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.8.svg b/assets/signs/3.8.svg new file mode 100644 index 0000000..d67b4eb --- /dev/null +++ b/assets/signs/3.8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/3.9.svg b/assets/signs/3.9.svg new file mode 100644 index 0000000..29aca33 --- /dev/null +++ b/assets/signs/3.9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.1.svg b/assets/signs/4.1.1.svg new file mode 100644 index 0000000..8348adc --- /dev/null +++ b/assets/signs/4.1.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.2.svg b/assets/signs/4.1.2.svg new file mode 100644 index 0000000..db58233 --- /dev/null +++ b/assets/signs/4.1.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.3.svg b/assets/signs/4.1.3.svg new file mode 100644 index 0000000..36e5f8c --- /dev/null +++ b/assets/signs/4.1.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.4.svg b/assets/signs/4.1.4.svg new file mode 100644 index 0000000..d183e5c --- /dev/null +++ b/assets/signs/4.1.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.5.svg b/assets/signs/4.1.5.svg new file mode 100644 index 0000000..e043af8 --- /dev/null +++ b/assets/signs/4.1.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.1.6.svg b/assets/signs/4.1.6.svg new file mode 100644 index 0000000..22eefaf --- /dev/null +++ b/assets/signs/4.1.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.2.1.svg b/assets/signs/4.2.1.svg new file mode 100644 index 0000000..a3748e2 --- /dev/null +++ b/assets/signs/4.2.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.2.2.svg b/assets/signs/4.2.2.svg new file mode 100644 index 0000000..4327a45 --- /dev/null +++ b/assets/signs/4.2.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.2.3.svg b/assets/signs/4.2.3.svg new file mode 100644 index 0000000..4f5114d --- /dev/null +++ b/assets/signs/4.2.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.3.svg b/assets/signs/4.3.svg new file mode 100644 index 0000000..f18931f --- /dev/null +++ b/assets/signs/4.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.4.1.svg b/assets/signs/4.4.1.svg new file mode 100644 index 0000000..b2524a1 --- /dev/null +++ b/assets/signs/4.4.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.4.2.svg b/assets/signs/4.4.2.svg new file mode 100644 index 0000000..9a03096 --- /dev/null +++ b/assets/signs/4.4.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.1.svg b/assets/signs/4.5.1.svg new file mode 100644 index 0000000..08b25a9 --- /dev/null +++ b/assets/signs/4.5.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.2.svg b/assets/signs/4.5.2.svg new file mode 100644 index 0000000..9afa16d --- /dev/null +++ b/assets/signs/4.5.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.3.svg b/assets/signs/4.5.3.svg new file mode 100644 index 0000000..a1aba96 --- /dev/null +++ b/assets/signs/4.5.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.4.svg b/assets/signs/4.5.4.svg new file mode 100644 index 0000000..ab9497e --- /dev/null +++ b/assets/signs/4.5.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.5.svg b/assets/signs/4.5.5.svg new file mode 100644 index 0000000..121c5e1 --- /dev/null +++ b/assets/signs/4.5.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.6.svg b/assets/signs/4.5.6.svg new file mode 100644 index 0000000..02a7f19 --- /dev/null +++ b/assets/signs/4.5.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.5.7.svg b/assets/signs/4.5.7.svg new file mode 100644 index 0000000..eb84cce --- /dev/null +++ b/assets/signs/4.5.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.6.svg b/assets/signs/4.6.svg new file mode 100644 index 0000000..364a120 --- /dev/null +++ b/assets/signs/4.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.7.svg b/assets/signs/4.7.svg new file mode 100644 index 0000000..780c8fa --- /dev/null +++ b/assets/signs/4.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.8.1.svg b/assets/signs/4.8.1.svg new file mode 100644 index 0000000..a413188 --- /dev/null +++ b/assets/signs/4.8.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.8.2.svg b/assets/signs/4.8.2.svg new file mode 100644 index 0000000..a413188 --- /dev/null +++ b/assets/signs/4.8.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/4.8.3.svg b/assets/signs/4.8.3.svg new file mode 100644 index 0000000..a413188 --- /dev/null +++ b/assets/signs/4.8.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.1.svg b/assets/signs/5.1.svg new file mode 100644 index 0000000..1605040 --- /dev/null +++ b/assets/signs/5.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.10.svg b/assets/signs/5.10.svg new file mode 100644 index 0000000..0fcd7ee --- /dev/null +++ b/assets/signs/5.10.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.11.1.svg b/assets/signs/5.11.1.svg new file mode 100644 index 0000000..07d8fc5 --- /dev/null +++ b/assets/signs/5.11.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.11.2.svg b/assets/signs/5.11.2.svg new file mode 100644 index 0000000..b2a8345 --- /dev/null +++ b/assets/signs/5.11.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.12.1.svg b/assets/signs/5.12.1.svg new file mode 100644 index 0000000..fa50bac --- /dev/null +++ b/assets/signs/5.12.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.12.2.svg b/assets/signs/5.12.2.svg new file mode 100644 index 0000000..fbde6d8 --- /dev/null +++ b/assets/signs/5.12.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.13.1.svg b/assets/signs/5.13.1.svg new file mode 100644 index 0000000..eeeff91 --- /dev/null +++ b/assets/signs/5.13.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.13.2.svg b/assets/signs/5.13.2.svg new file mode 100644 index 0000000..eeeff91 --- /dev/null +++ b/assets/signs/5.13.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.14.1.svg b/assets/signs/5.14.1.svg new file mode 100644 index 0000000..b740c71 --- /dev/null +++ b/assets/signs/5.14.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.14.2.svg b/assets/signs/5.14.2.svg new file mode 100644 index 0000000..a0445b7 --- /dev/null +++ b/assets/signs/5.14.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.14.3.svg b/assets/signs/5.14.3.svg new file mode 100644 index 0000000..0718fae --- /dev/null +++ b/assets/signs/5.14.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.14.4.svg b/assets/signs/5.14.4.svg new file mode 100644 index 0000000..f337e14 --- /dev/null +++ b/assets/signs/5.14.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.1.svg b/assets/signs/5.15.1.svg new file mode 100644 index 0000000..51ed06b --- /dev/null +++ b/assets/signs/5.15.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.2.svg b/assets/signs/5.15.2.svg new file mode 100644 index 0000000..8613a6a --- /dev/null +++ b/assets/signs/5.15.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.3.svg b/assets/signs/5.15.3.svg new file mode 100644 index 0000000..882f7eb --- /dev/null +++ b/assets/signs/5.15.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.4.svg b/assets/signs/5.15.4.svg new file mode 100644 index 0000000..bb75f68 --- /dev/null +++ b/assets/signs/5.15.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.5.svg b/assets/signs/5.15.5.svg new file mode 100644 index 0000000..c708766 --- /dev/null +++ b/assets/signs/5.15.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.6.svg b/assets/signs/5.15.6.svg new file mode 100644 index 0000000..60dc919 --- /dev/null +++ b/assets/signs/5.15.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.7.svg b/assets/signs/5.15.7.svg new file mode 100644 index 0000000..1ae35a4 --- /dev/null +++ b/assets/signs/5.15.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.15.8.svg b/assets/signs/5.15.8.svg new file mode 100644 index 0000000..cffa316 --- /dev/null +++ b/assets/signs/5.15.8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.16.svg b/assets/signs/5.16.svg new file mode 100644 index 0000000..7df8733 --- /dev/null +++ b/assets/signs/5.16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.17.svg b/assets/signs/5.17.svg new file mode 100644 index 0000000..4287cf9 --- /dev/null +++ b/assets/signs/5.17.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.18.svg b/assets/signs/5.18.svg new file mode 100644 index 0000000..63728b2 --- /dev/null +++ b/assets/signs/5.18.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.19.1.svg b/assets/signs/5.19.1.svg new file mode 100644 index 0000000..c825c32 --- /dev/null +++ b/assets/signs/5.19.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.19.2.svg b/assets/signs/5.19.2.svg new file mode 100644 index 0000000..c825c32 --- /dev/null +++ b/assets/signs/5.19.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.2.svg b/assets/signs/5.2.svg new file mode 100644 index 0000000..02be008 --- /dev/null +++ b/assets/signs/5.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.20.svg b/assets/signs/5.20.svg new file mode 100644 index 0000000..3857937 --- /dev/null +++ b/assets/signs/5.20.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.21.svg b/assets/signs/5.21.svg new file mode 100644 index 0000000..90b1b80 --- /dev/null +++ b/assets/signs/5.21.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.22.svg b/assets/signs/5.22.svg new file mode 100644 index 0000000..afefd0d --- /dev/null +++ b/assets/signs/5.22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.23.1.svg b/assets/signs/5.23.1.svg new file mode 100644 index 0000000..33034ef --- /dev/null +++ b/assets/signs/5.23.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.23.2.svg b/assets/signs/5.23.2.svg new file mode 100644 index 0000000..33034ef --- /dev/null +++ b/assets/signs/5.23.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.24.1.svg b/assets/signs/5.24.1.svg new file mode 100644 index 0000000..225734c --- /dev/null +++ b/assets/signs/5.24.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.24.2.svg b/assets/signs/5.24.2.svg new file mode 100644 index 0000000..225734c --- /dev/null +++ b/assets/signs/5.24.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.25.svg b/assets/signs/5.25.svg new file mode 100644 index 0000000..d395aed --- /dev/null +++ b/assets/signs/5.25.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.26.svg b/assets/signs/5.26.svg new file mode 100644 index 0000000..0bd8022 --- /dev/null +++ b/assets/signs/5.26.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.27.svg b/assets/signs/5.27.svg new file mode 100644 index 0000000..404ef93 --- /dev/null +++ b/assets/signs/5.27.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.28.svg b/assets/signs/5.28.svg new file mode 100644 index 0000000..8d5f643 --- /dev/null +++ b/assets/signs/5.28.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.29.svg b/assets/signs/5.29.svg new file mode 100644 index 0000000..defb692 --- /dev/null +++ b/assets/signs/5.29.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.3.svg b/assets/signs/5.3.svg new file mode 100644 index 0000000..a403fc5 --- /dev/null +++ b/assets/signs/5.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.30.svg b/assets/signs/5.30.svg new file mode 100644 index 0000000..5f95d81 --- /dev/null +++ b/assets/signs/5.30.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.31.svg b/assets/signs/5.31.svg new file mode 100644 index 0000000..92a67a4 --- /dev/null +++ b/assets/signs/5.31.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.32.svg b/assets/signs/5.32.svg new file mode 100644 index 0000000..6a08e8f --- /dev/null +++ b/assets/signs/5.32.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.33.svg b/assets/signs/5.33.svg new file mode 100644 index 0000000..4f8de99 --- /dev/null +++ b/assets/signs/5.33.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.34.svg b/assets/signs/5.34.svg new file mode 100644 index 0000000..3022687 --- /dev/null +++ b/assets/signs/5.34.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.35.svg b/assets/signs/5.35.svg new file mode 100644 index 0000000..3a458a6 --- /dev/null +++ b/assets/signs/5.35.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.36.svg b/assets/signs/5.36.svg new file mode 100644 index 0000000..1c01cc2 --- /dev/null +++ b/assets/signs/5.36.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.37.svg b/assets/signs/5.37.svg new file mode 100644 index 0000000..786e775 --- /dev/null +++ b/assets/signs/5.37.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.38.svg b/assets/signs/5.38.svg new file mode 100644 index 0000000..d93081d --- /dev/null +++ b/assets/signs/5.38.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.39.svg b/assets/signs/5.39.svg new file mode 100644 index 0000000..4a5bd6d --- /dev/null +++ b/assets/signs/5.39.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.4.svg b/assets/signs/5.4.svg new file mode 100644 index 0000000..25cf108 --- /dev/null +++ b/assets/signs/5.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.40.svg b/assets/signs/5.40.svg new file mode 100644 index 0000000..e609db5 --- /dev/null +++ b/assets/signs/5.40.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/signs/5.5.svg b/assets/signs/5.5.svg new file mode 100644 index 0000000..0645849 --- /dev/null +++ b/assets/signs/5.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.6.svg b/assets/signs/5.6.svg new file mode 100644 index 0000000..520b5f1 --- /dev/null +++ b/assets/signs/5.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.7.1.svg b/assets/signs/5.7.1.svg new file mode 100644 index 0000000..4de4cb1 --- /dev/null +++ b/assets/signs/5.7.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.7.2.svg b/assets/signs/5.7.2.svg new file mode 100644 index 0000000..4de4cb1 --- /dev/null +++ b/assets/signs/5.7.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.8.svg b/assets/signs/5.8.svg new file mode 100644 index 0000000..1a63dec --- /dev/null +++ b/assets/signs/5.8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/5.9.svg b/assets/signs/5.9.svg new file mode 100644 index 0000000..b83108f --- /dev/null +++ b/assets/signs/5.9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.1.svg b/assets/signs/6.1.svg new file mode 100644 index 0000000..4dc29dd --- /dev/null +++ b/assets/signs/6.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.16.svg b/assets/signs/6.16.svg new file mode 100644 index 0000000..ceddf98 --- /dev/null +++ b/assets/signs/6.16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.2.svg b/assets/signs/6.2.svg new file mode 100644 index 0000000..73bdcc1 --- /dev/null +++ b/assets/signs/6.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.22.svg b/assets/signs/6.22.svg new file mode 100644 index 0000000..26820c0 --- /dev/null +++ b/assets/signs/6.22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.3.1.svg b/assets/signs/6.3.1.svg new file mode 100644 index 0000000..20e971e --- /dev/null +++ b/assets/signs/6.3.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.3.2.svg b/assets/signs/6.3.2.svg new file mode 100644 index 0000000..6870475 --- /dev/null +++ b/assets/signs/6.3.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.4.svg b/assets/signs/6.4.svg new file mode 100644 index 0000000..3b3d453 --- /dev/null +++ b/assets/signs/6.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.5.svg b/assets/signs/6.5.svg new file mode 100644 index 0000000..ace790d --- /dev/null +++ b/assets/signs/6.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.6.svg b/assets/signs/6.6.svg new file mode 100644 index 0000000..93848eb --- /dev/null +++ b/assets/signs/6.6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.7.svg b/assets/signs/6.7.svg new file mode 100644 index 0000000..2788312 --- /dev/null +++ b/assets/signs/6.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.8.1.svg b/assets/signs/6.8.1.svg new file mode 100644 index 0000000..52419ef --- /dev/null +++ b/assets/signs/6.8.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.8.2.svg b/assets/signs/6.8.2.svg new file mode 100644 index 0000000..864fe59 --- /dev/null +++ b/assets/signs/6.8.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/6.8.3.svg b/assets/signs/6.8.3.svg new file mode 100644 index 0000000..7a15319 --- /dev/null +++ b/assets/signs/6.8.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.1.svg b/assets/signs/7.1.svg new file mode 100644 index 0000000..d76fafb --- /dev/null +++ b/assets/signs/7.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.12.svg b/assets/signs/7.12.svg new file mode 100644 index 0000000..495e471 --- /dev/null +++ b/assets/signs/7.12.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.19.svg b/assets/signs/7.19.svg new file mode 100644 index 0000000..c030f0d --- /dev/null +++ b/assets/signs/7.19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.2.svg b/assets/signs/7.2.svg new file mode 100644 index 0000000..2004d1b --- /dev/null +++ b/assets/signs/7.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.21.svg b/assets/signs/7.21.svg new file mode 100644 index 0000000..e846e34 --- /dev/null +++ b/assets/signs/7.21.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.3.svg b/assets/signs/7.3.svg new file mode 100644 index 0000000..a1571c3 --- /dev/null +++ b/assets/signs/7.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.4.svg b/assets/signs/7.4.svg new file mode 100644 index 0000000..4c8790e --- /dev/null +++ b/assets/signs/7.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.5.svg b/assets/signs/7.5.svg new file mode 100644 index 0000000..a09cd28 --- /dev/null +++ b/assets/signs/7.5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/7.7.svg b/assets/signs/7.7.svg new file mode 100644 index 0000000..297b78c --- /dev/null +++ b/assets/signs/7.7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.1.1.svg b/assets/signs/8.1.1.svg new file mode 100644 index 0000000..6c12802 --- /dev/null +++ b/assets/signs/8.1.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.13.svg b/assets/signs/8.13.svg new file mode 100644 index 0000000..7739243 --- /dev/null +++ b/assets/signs/8.13.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.14.svg b/assets/signs/8.14.svg new file mode 100644 index 0000000..e1dddbb --- /dev/null +++ b/assets/signs/8.14.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.15.svg b/assets/signs/8.15.svg new file mode 100644 index 0000000..af3d714 --- /dev/null +++ b/assets/signs/8.15.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.16.svg b/assets/signs/8.16.svg new file mode 100644 index 0000000..a289efd --- /dev/null +++ b/assets/signs/8.16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.17.svg b/assets/signs/8.17.svg new file mode 100644 index 0000000..64df58b --- /dev/null +++ b/assets/signs/8.17.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.18.svg b/assets/signs/8.18.svg new file mode 100644 index 0000000..f0a7575 --- /dev/null +++ b/assets/signs/8.18.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.2.1.svg b/assets/signs/8.2.1.svg new file mode 100644 index 0000000..8dc4092 --- /dev/null +++ b/assets/signs/8.2.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.2.2.svg b/assets/signs/8.2.2.svg new file mode 100644 index 0000000..8dc4092 --- /dev/null +++ b/assets/signs/8.2.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.2.3.svg b/assets/signs/8.2.3.svg new file mode 100644 index 0000000..8dc4092 --- /dev/null +++ b/assets/signs/8.2.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.2.4.svg b/assets/signs/8.2.4.svg new file mode 100644 index 0000000..8dc4092 --- /dev/null +++ b/assets/signs/8.2.4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.22.1.svg b/assets/signs/8.22.1.svg new file mode 100644 index 0000000..f48fa64 --- /dev/null +++ b/assets/signs/8.22.1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.22.2.svg b/assets/signs/8.22.2.svg new file mode 100644 index 0000000..f48fa64 --- /dev/null +++ b/assets/signs/8.22.2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.22.3.svg b/assets/signs/8.22.3.svg new file mode 100644 index 0000000..f48fa64 --- /dev/null +++ b/assets/signs/8.22.3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/signs/8.24.svg b/assets/signs/8.24.svg new file mode 100644 index 0000000..fc17143 --- /dev/null +++ b/assets/signs/8.24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/calibration_image_sample_data_20x128x128x3_float32.npy b/calibration_image_sample_data_20x128x128x3_float32.npy new file mode 100644 index 0000000..6f76d41 Binary files /dev/null and b/calibration_image_sample_data_20x128x128x3_float32.npy differ diff --git a/context/2026-09-26_05-13_flutter-sign-checker.md b/context/2026-09-26_05-13_flutter-sign-checker.md new file mode 100644 index 0000000..538f844 --- /dev/null +++ b/context/2026-09-26_05-13_flutter-sign-checker.md @@ -0,0 +1,29 @@ +# 2026-09-26 Приложение распознавания знаков РФ + +Собран Android-проект Flutter `sign_checker` (пакет `com.signchecker.sign_checker`). + +## Что делает + +- Камера в реальном времени, задняя камера, без микрофона. +- Справочник знаков по приложению 1 к ПДД: номер, название, краткий смысл, что делать водителю. +- Когда в `assets/models/` лежит модель, кадры идут в YOLO TFLite. Карточка знака показывается только если метка модели содержит известный номер (`3.27`, `3_27`). Произвольное имя класса не привязывается к правилу. +- Знаки с цифрой или схемой на лице (скорость, масса, стрелки полос) помечены: приложение не читает эту надпись. +- Стабилизатор показывает знак со второго подряд кадра и держит одну пропажу, чтобы рамка не мигала. + +## Почему модели нет в репозитории + +Готовой проверенной float32-модели с классами-номерами ПДД под эту сборку не подключал. Чужие веса с другим порядком классов показали бы неверный знак и чужое правило. Это опаснее, чем честное «модель не установлена». Справочник при этом работает. + +Подключение: `tools/export_signs_model.py` и текст на экране настроек. Файл `assets/models/signs.tflite`, классы по индексу в `assets/models/labels.txt`. Вход NHWC float32 `[1, N, N, 3]`, лучше `imgsz=320`. Не half и не int8. + +## Слои + +- `lib/domain` — каталог, декодер YOLO, letterbox, поворот кадра, стабилизатор. Без Flutter, кроме того что UI живёт отдельно. +- `lib/data` — тексты знаков, YUV→тензор, изолят TFLite. +- `lib/presentation` — камера, карточка, справочник. + +## Сборка + +`tflite_flutter` 0.12.1 на Kotlin 2.4 собирал Java 11 и Kotlin JVM 25. В `android/build.gradle.kts` библиотечные модули выровнены на JVM 17. Debug APK собрался: `build/app/outputs/flutter-apk/app-debug.apk`. + +Телефона в сессии не было, живую камеру и инференс на устройстве не прогонял. `flutter analyze` чистый, `flutter test` — 12 тестов. diff --git a/context/2026-09-26_10-49_hf-russian-road-signs.md b/context/2026-09-26_10-49_hf-russian-road-signs.md new file mode 100644 index 0000000..175c3d1 --- /dev/null +++ b/context/2026-09-26_10-49_hf-russian-road-signs.md @@ -0,0 +1,11 @@ +# 2026-09-26 Датасет Dognellaf/russian-road-signs + +Решение: датасет можно использовать для обучения детектора приложения. + +- Лицензия CC BY 4.0, нужно указать авторство. +- YOLO, ~44k JPEG, 89 классов, имена в основном номера ПДД. Объём около 26 ГБ, отдельного val-сплита в карточке нет. +- Перед обучением: делить по ролику, не по соседним кадрам. +- `3.24.1`…`3.24.11` — варианты скорости, в справочнике это один знак 3.24. Точное число на знаке из суффикса не выводить, пока нет легенды автора. +- Классы светофоров (`redTrafficLights` и соседние) к карточкам знаков не привязывать. +- `2.3`, `1.12`, `5.14`, `3.36`, `3.13.35` в текущем справочнике нет: правило не выдумывать. +- В APK кладётся только экспортированный float32 `.tflite` и `labels.txt` в порядке `classes.txt`. diff --git a/context/2026-09-26_19-20_hf-train-tflite.md b/context/2026-09-26_19-20_hf-train-tflite.md new file mode 100644 index 0000000..84ccfb3 --- /dev/null +++ b/context/2026-09-26_19-20_hf-train-tflite.md @@ -0,0 +1,20 @@ +# 2026-09-26 Обучение на Dognellaf/russian-road-signs + +В приложение положена своя float32-модель, обученная на датасете Dognellaf/russian-road-signs (CC BY 4.0). Неразмеченные видео не скачивались. + +## Данные + +- Скрипт `tools/prepare_hf_dataset.py`. Сплит по ролику, не по соседним кадрам: 12034 ролика, 34424 train, 5776 val. +- В списки попали только кадры, у которых есть `.txt` разметки. Одинаковые имена файлов из `images/` и `images/part_*` схлопнуты. +- В `classes.txt` 90 непустых строк, карточка пишет 89. Индексы взяты из файла как есть. +- Строки в `train.txt` / `val.txt` абсолютные. Относительный `images/...` Ultralytics на Windows резолвит от cwd и не находит `labels/`. + +## Модель + +- YOLO11n, imgsz 320, 40 эпох, batch 32, RTX 5060 Ti. Val: mAP50 0.614, mAP50-95 0.458. +- Экспорт LiteRT на Windows недоступен. Float32 TFLite получен через SavedModel/onnx2tf: `assets/models/signs.tflite` (10.6 МБ). +- Вход `[1, 320, 320, 3]` float32 NHWC, выход `[1, 94, 2100]` float32. `labels.txt` совпадает с `classes.txt`. +- `3.24.1`…`3.24.11` открывают знак 3.24, число скорости не угадывается. Светофоры — отдельные карточки сигнала, без цвета у класса `TrafficLights`. Кодов вне справочника в карточке нет. +- Авторство датасета на экране справки. + +Debug APK: `build/app/outputs/flutter-apk/app-debug.apk`. На телефоне в этой сессии не проверялся. diff --git a/context/2026-09-26_22-15_drom-sign-svgs.md b/context/2026-09-26_22-15_drom-sign-svgs.md new file mode 100644 index 0000000..495939c --- /dev/null +++ b/context/2026-09-26_22-15_drom-sign-svgs.md @@ -0,0 +1,7 @@ +# 2026-09-26 Схемы знаков с drom.ru + +Со страницы https://www.drom.ru/pdd/pdd/signs/ скачаны только SVG-рисунки знаков, без текста пояснений. Скрипт: `tools/fetch_drom_sign_svgs.py`. Файлы: `assets/signs/<номер>.svg`. + +В справочнике 216 номеров из 221 имеют схему. Пять карточек светофора остаются без рисунка. Если на странице несколько номеров стоят у одной картинки (1.4.1–1.4.6, 5.19.1 и 5.19.2, 8.22.1–8.22.3), в приложении у них одна общая схема. + +Рисунок показывается в списке справочника, на карточке знака и в панели камеры. У знаков с цифрой на лице (скорость и похожие) схема с сайта содержит пример числа; предупреждение «смотрите цифру на знаке» осталось. diff --git a/lib/app/sign_checker_app.dart b/lib/app/sign_checker_app.dart new file mode 100644 index 0000000..6ceeb61 --- /dev/null +++ b/lib/app/sign_checker_app.dart @@ -0,0 +1,35 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; + +import '../core/branding/app_brand.dart'; +import '../presentation/camera/camera_screen.dart'; +import '../presentation/camera/recognition_controller.dart'; +import '../theme/theme.dart'; + +class SignCheckerApp extends StatelessWidget { + const SignCheckerApp({super.key, this.controller}); + + final RecognitionController? controller; + + @override + Widget build(BuildContext context) { + return CupertinoApp( + title: AppBrand.name, + theme: buildDarkTheme(), + builder: (context, child) { + final brightness = MediaQuery.platformBrightnessOf(context); + final overlay = systemUiOverlayFor(brightness); + return CupertinoTheme( + data: brightness == Brightness.dark + ? buildDarkTheme() + : buildLightTheme(), + child: AnnotatedRegion( + value: overlay, + child: child ?? const SizedBox.shrink(), + ), + ); + }, + home: CameraScreen(controller: controller ?? RecognitionController()), + ); + } +} diff --git a/lib/core/branding/app_brand.dart b/lib/core/branding/app_brand.dart new file mode 100644 index 0000000..d98abca --- /dev/null +++ b/lib/core/branding/app_brand.dart @@ -0,0 +1,4 @@ +abstract final class AppBrand { + static const name = 'Sign Detector'; + static const iconAsset = 'assets/branding/app_icon.png'; +} diff --git a/lib/data/catalog/bundled_sign_catalog.dart b/lib/data/catalog/bundled_sign_catalog.dart new file mode 100644 index 0000000..158686c --- /dev/null +++ b/lib/data/catalog/bundled_sign_catalog.dart @@ -0,0 +1,4 @@ +import '../../domain/sign_catalog.dart'; +import 'sign_definitions.dart'; + +final SignCatalog bundledSignCatalog = SignCatalog(signDefinitions); diff --git a/lib/data/catalog/sign_definitions.dart b/lib/data/catalog/sign_definitions.dart new file mode 100644 index 0000000..92bc62d --- /dev/null +++ b/lib/data/catalog/sign_definitions.dart @@ -0,0 +1,1615 @@ +import '../../domain/traffic_sign.dart'; + +TrafficSign _s( + String code, + SignCategory category, + String name, + String summary, + String action, [ + bool readFace = false, +]) { + return TrafficSign( + code: code, + category: category, + name: name, + summary: summary, + action: action, + requiresReadingTheSign: readFace, + ); +} + +const _warnDistance = + 'Знак стоит до опасного участка: обычно 150–300 м вне населённого пункта и 50–100 м в нём, если табличка 8.1.1 не указывает другое расстояние.'; + +/// Краткие формулировки по приложению 1 к ПДД. +/// Это подсказка, а не полный текст правил. +final List signDefinitions = [ + _s( + '1.1', + SignCategory.warning, + 'Железнодорожный переезд со шлагбаумом', + 'Впереди переезд, оборудованный шлагбаумом. $_warnDistance', + 'Снизьте скорость и будьте готовы остановиться перед переездом.', + ), + _s( + '1.2', + SignCategory.warning, + 'Железнодорожный переезд без шлагбаума', + 'Впереди переезд без шлагбаума. $_warnDistance', + 'Снизьте скорость и убедитесь, что поезда нет, прежде чем выезжать на переезд.', + ), + _s( + '1.3.1', + SignCategory.warning, + 'Однопутная железная дорога', + 'Переезд без шлагбаума через один путь.', + 'Остановитесь, если этого требуют правила проезда переезда, и пропустите поезд.', + ), + _s( + '1.3.2', + SignCategory.warning, + 'Многопутная железная дорога', + 'Переезд без шлагбаума через два пути и более.', + 'Не выезжайте на переезд, пока не убедитесь, что свободен весь переезд, а не только ближайший путь.', + ), + _s( + '1.4.1', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Снижайте скорость: переезд ещё впереди.', + ), + _s( + '1.4.2', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Снижайте скорость: переезд ещё впереди.', + ), + _s( + '1.4.3', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Снижайте скорость: переезд близко.', + ), + _s( + '1.4.4', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Снижайте скорость: переезд близко.', + ), + _s( + '1.4.5', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Будьте готовы остановиться: переезд непосредственно впереди.', + ), + _s( + '1.4.6', + SignCategory.warning, + 'Приближение к железнодорожному переезду', + 'Дополнительное предупреждение о переезде вне населённого пункта.', + 'Будьте готовы остановиться: переезд непосредственно впереди.', + ), + _s( + '1.5', + SignCategory.warning, + 'Пересечение с трамвайной линией', + 'Впереди пересечение с трамвайными путями. $_warnDistance', + 'Уступите трамваю в случаях, когда этого требуют правила проезда.', + ), + _s( + '1.6', + SignCategory.warning, + 'Пересечение равнозначных дорог', + 'Впереди пересечение равнозначных дорог.', + 'Уступите транспортным средствам, приближающимся справа.', + ), + _s( + '1.7', + SignCategory.warning, + 'Пересечение с круговым движением', + 'Впереди перекрёсток с круговым движением.', + 'Снизьте скорость и проезжайте круг по правилам знаков приоритета на въезде.', + ), + _s( + '1.8', + SignCategory.warning, + 'Светофорное регулирование', + 'Перекрёсток, переход или участок, где движение регулирует светофор.', + 'Будьте готовы остановиться на запрещающий сигнал.', + ), + _s( + '1.9', + SignCategory.warning, + 'Разводной мост', + 'Впереди разводной мост или паромная переправа.', + 'Снизьте скорость и не въезжайте, если въезд закрыт.', + ), + _s( + '1.10', + SignCategory.warning, + 'Выезд на набережную', + 'Впереди выезд на набережную или берег.', + 'Снизьте скорость и не подъезжайте к краю.', + ), + _s( + '1.11.1', + SignCategory.warning, + 'Опасный поворот направо', + 'Закругление малого радиуса или с ограниченной видимостью направо.', + 'Снизьте скорость до входа в поворот.', + ), + _s( + '1.11.2', + SignCategory.warning, + 'Опасный поворот налево', + 'Закругление малого радиуса или с ограниченной видимостью налево.', + 'Снизьте скорость до входа в поворот.', + ), + _s( + '1.12.1', + SignCategory.warning, + 'Опасные повороты', + 'Участок с опасными поворотами, первый — направо.', + 'Снизьте скорость на всём участке.', + ), + _s( + '1.12.2', + SignCategory.warning, + 'Опасные повороты', + 'Участок с опасными поворотами, первый — налево.', + 'Снизьте скорость на всём участке.', + ), + _s( + '1.13', + SignCategory.warning, + 'Крутой спуск', + 'Крутой спуск. Процент уклона указан на знаке.', + 'Включите пониженную передачу заранее и держите дистанцию. Процент смотрите на знаке.', + true, + ), + _s( + '1.14', + SignCategory.warning, + 'Крутой подъём', + 'Крутой подъём. Процент уклона указан на знаке.', + 'Учитывайте разгон и уступайте при необходимости на узком участке. Процент смотрите на знаке.', + true, + ), + _s( + '1.15', + SignCategory.warning, + 'Скользкая дорога', + 'Участок с повышенной скользкостью проезжей части.', + 'Снизьте скорость и избегайте резких манёвров и торможения.', + ), + _s( + '1.16', + SignCategory.warning, + 'Неровная дорога', + 'Неровности: волны, выбоины, стыки с мостами.', + 'Снизьте скорость до участка.', + ), + _s( + '1.17', + SignCategory.warning, + 'Искусственная неровность', + 'Впереди искусственная неровность для снижения скорости.', + 'Снизьте скорость перед неровностью.', + ), + _s( + '1.18', + SignCategory.warning, + 'Выброс гравия', + 'Из-под колёс возможен выброс гравия или щебня.', + 'Увеличьте дистанцию и снизьте скорость.', + ), + _s( + '1.19', + SignCategory.warning, + 'Опасная обочина', + 'Съезд на обочину опасен.', + 'Не съезжайте на обочину без необходимости.', + ), + _s( + '1.20.1', + SignCategory.warning, + 'Сужение дороги', + 'Дорога сужается с обеих сторон.', + 'Займите полосу заранее и уступите, если перестроение уже затруднено.', + ), + _s( + '1.20.2', + SignCategory.warning, + 'Сужение дороги справа', + 'Дорога сужается справа.', + 'Будьте готовы перестроиться левее.', + ), + _s( + '1.20.3', + SignCategory.warning, + 'Сужение дороги слева', + 'Дорога сужается слева.', + 'Держитесь правее и следите за перестраивающимися.', + ), + _s( + '1.21', + SignCategory.warning, + 'Двустороннее движение', + 'Начинается участок со встречным движением.', + 'Держитесь правее и не выезжайте на встречную полосу.', + ), + _s( + '1.22', + SignCategory.warning, + 'Пешеходный переход', + 'Предупреждение о переходе впереди. Сам переход обозначают знаки 5.19.1 и 5.19.2.', + 'Снизьте скорость и будьте готовы остановиться перед переходом.', + ), + _s( + '1.23', + SignCategory.warning, + 'Дети', + 'Участок рядом с детским учреждением, дети могут выйти на проезжую часть.', + 'Снизьте скорость и будьте готовы к внезапному появлению детей.', + ), + _s( + '1.24', + SignCategory.warning, + 'Пересечение с велосипедной дорожкой', + 'Впереди пересечение с велосипедной или велопешеходной дорожкой.', + 'Уступите велосипедистам на пересечении, если этого требуют правила проезда.', + ), + _s( + '1.25', + SignCategory.warning, + 'Дорожные работы', + 'Впереди участок дорожных работ.', + 'Снизьте скорость. При краткосрочных работах знак может стоять за 10–15 м. Временные знаки важнее постоянных, если они противоречат друг другу.', + ), + _s( + '1.26', + SignCategory.warning, + 'Перегон скота', + 'Возможен перегон скота.', + 'Снизьте скорость и пропустите животных.', + ), + _s( + '1.27', + SignCategory.warning, + 'Дикие животные', + 'Возможен выход диких животных.', + 'Снизьте скорость, особенно в тёмное время.', + ), + _s( + '1.28', + SignCategory.warning, + 'Падение камней', + 'Возможны обвалы, оползни или падение камней.', + 'Не останавливайтесь в зоне камнепада без необходимости и следите за склоном.', + ), + _s( + '1.29', + SignCategory.warning, + 'Боковой ветер', + 'Участок с сильным боковым ветром.', + 'Снизьте скорость и крепче держите руль на открытом месте.', + ), + _s( + '1.30', + SignCategory.warning, + 'Низколетящие самолёты', + 'Над дорогой низко пролетают самолёты.', + 'Не пугайтесь шума и не тормозите резко.', + ), + _s( + '1.31', + SignCategory.warning, + 'Тоннель', + 'Тоннель без освещения или с плохой видимостью въездного портала.', + 'Включите ближний свет до въезда.', + ), + _s( + '1.32', + SignCategory.warning, + 'Затор', + 'Впереди участок, на котором образовался затор.', + 'Выберите объезд, если он есть, и не въезжайте на перекрёсток, если за ним нет места.', + ), + _s( + '1.33', + SignCategory.warning, + 'Прочие опасности', + 'Опасность, для которой нет отдельного предупреждающего знака.', + 'Снизьте скорость и выясните причину по обстановке. Жёлтый фон означает временный знак.', + ), + _s( + '1.34.1', + SignCategory.warning, + 'Направление поворота', + 'Направление движения на крутом закруглении направо или объезд ремонта.', + 'Следуйте по направлению стрелки и снизьте скорость.', + ), + _s( + '1.34.2', + SignCategory.warning, + 'Направление поворота', + 'Направление движения на крутом закруглении налево или объезд ремонта.', + 'Следуйте по направлению стрелки и снизьте скорость.', + ), + _s( + '1.34.3', + SignCategory.warning, + 'Направление поворота', + 'Направления на Т-образном перекрёстке, развилке или при объезде ремонта.', + 'Двигайтесь только в направлении, которое показывает знак.', + ), + _s( + '1.35', + SignCategory.warning, + 'Участок перекрёстка', + 'Приближение к перекрёстку, на который нельзя выезжать, если впереди затор заставит остановиться и помешать поперечному движению.', + 'Не выезжайте на перекрёсток, если за ним нет места в вашем направлении. Поворот направо или налево — только в случаях, которые прямо разрешают правила.', + ), + _s( + '2.1', + SignCategory.priority, + 'Главная дорога', + 'На этой дороге есть преимущество на нерегулируемых перекрёстках.', + 'Вы проезжаете нерегулируемый перекрёсток раньше тех, кто на второстепенной. Направление главной может менять табличка 8.13.', + ), + _s( + '2.2', + SignCategory.priority, + 'Конец главной дороги', + 'Заканчивается главная дорога.', + 'Дальше преимущество нужно определять заново: по знакам или по правилу помехи справа.', + ), + _s( + '2.3.1', + SignCategory.priority, + 'Пересечение со второстепенной дорогой', + 'Впереди пересечение, где пересекаемая дорога второстепенная.', + 'Вы на главной, но всё равно снизьте скорость и убедитесь, что вам уступают.', + ), + _s( + '2.3.2', + SignCategory.priority, + 'Примыкание второстепенной дороги справа', + 'Справа примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими справа.', + ), + _s( + '2.3.3', + SignCategory.priority, + 'Примыкание второстепенной дороги слева', + 'Слева примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими слева.', + ), + _s( + '2.3.4', + SignCategory.priority, + 'Примыкание второстепенной дороги справа', + 'Справа примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими справа.', + ), + _s( + '2.3.5', + SignCategory.priority, + 'Примыкание второстепенной дороги слева', + 'Слева примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими слева.', + ), + _s( + '2.3.6', + SignCategory.priority, + 'Примыкание второстепенной дороги справа', + 'Справа примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими справа.', + ), + _s( + '2.3.7', + SignCategory.priority, + 'Примыкание второстепенной дороги слева', + 'Слева примыкает второстепенная дорога.', + 'Вы на главной. Следите за выезжающими слева.', + ), + _s( + '2.4', + SignCategory.priority, + 'Уступите дорогу', + 'Нужно уступить транспортным средствам на пересекаемой дороге, а при табличке 8.13 — тем, кто движется по главной.', + 'Снизьте скорость и уступите. Полная остановка обязательна только если без неё уступить нельзя.', + ), + _s( + '2.5', + SignCategory.priority, + 'Движение без остановки запрещено', + 'Нельзя продолжать движение без остановки перед стоп-линией, а если её нет — перед краем пересекаемой проезжей части. Затем нужно уступить дорогу.', + 'Остановитесь полностью, после этого уступите. Перед железнодорожным переездом или карантинным постом остановитесь перед стоп-линией, а если её нет — перед знаком.', + ), + _s( + '2.6', + SignCategory.priority, + 'Преимущество встречного движения', + 'Нельзя въезжать на узкий участок, если это затруднит встречных.', + 'Уступите встречным, которые уже на узком участке или у противоположного въезда.', + ), + _s( + '2.7', + SignCategory.priority, + 'Преимущество перед встречным движением', + 'На узком участке преимущество у вас.', + 'Можно въезжать, но только если встречный уже уступает и участок физически проходим.', + ), + _s( + '3.1', + SignCategory.prohibitory, + 'Въезд запрещён', + 'Запрещён въезд всех транспортных средств в этом направлении.', + 'Не въезжайте. На маршрутные транспортные средства запрет не распространяется.', + ), + _s( + '3.2', + SignCategory.prohibitory, + 'Движение запрещено', + 'Запрещено движение всех транспортных средств в обоих направлениях.', + 'Не продолжайте движение по этому участку. Есть исключения для транспорта, обслуживающего зону, почты и некоторых инвалидов — они указаны в ПДД.', + ), + _s( + '3.3', + SignCategory.prohibitory, + 'Движение механических транспортных средств запрещено', + 'Запрещено движение механических транспортных средств.', + 'Не въезжайте на механическом транспортном средстве. Исключения смотрите в ПДД.', + ), + _s( + '3.4', + SignCategory.prohibitory, + 'Движение грузовых автомобилей запрещено', + 'Запрещено движение грузовиков и составов тяжелее 3,5 т, если на знаке не указана другая масса, а также тракторов и самоходных машин.', + 'Если массы на знаке нет, запрет для грузовиков тяжелее 3,5 т. Если масса указана — смотрите цифру на знаке.', + true, + ), + _s( + '3.5', + SignCategory.prohibitory, + 'Движение мотоциклов запрещено', + 'Запрещено движение мотоциклов.', + 'Не въезжайте на мотоцикле.', + ), + _s( + '3.6', + SignCategory.prohibitory, + 'Движение тракторов запрещено', + 'Запрещено движение тракторов и самоходных машин.', + 'Не въезжайте на тракторе или самоходной машине.', + ), + _s( + '3.7', + SignCategory.prohibitory, + 'Движение с прицепом запрещено', + 'Запрещено движение грузовиков и тракторов с прицепом любого типа, а также буксировка механических транспортных средств.', + 'Не проезжайте с прицепом на грузовике или тракторе и не буксируйте.', + ), + _s( + '3.8', + SignCategory.prohibitory, + 'Движение гужевых повозок запрещено', + 'Запрещены гужевые повозки, верховые и вьючные животные, а также прогон скота.', + 'Не проезжайте на повозке и не гоните скот по этому участку.', + ), + _s( + '3.9', + SignCategory.prohibitory, + 'Движение на велосипедах запрещено', + 'Запрещено движение велосипедистов и лиц на мопедах.', + 'Спешьтесь и не едьте по проезжей части в зоне знака.', + ), + _s( + '3.10', + SignCategory.prohibitory, + 'Движение пешеходов запрещено', + 'Запрещено движение пешеходов и лиц на средствах индивидуальной мобильности. Действует на ту сторону, где установлен знак.', + 'Не идите по этой стороне и не едьте на средстве индивидуальной мобильности.', + ), + _s( + '3.11', + SignCategory.prohibitory, + 'Ограничение массы', + 'Нельзя ехать, если фактическая масса автомобиля или состава больше числа на знаке.', + 'Сравните фактическую массу с цифрой на знаке. Приложение цифру не читает.', + true, + ), + _s( + '3.12', + SignCategory.prohibitory, + 'Ограничение массы на ось', + 'Нельзя ехать, если фактическая нагрузка на какую-либо ось больше числа на знаке.', + 'Смотрите тонны на знаке. Таблички 8.20 уточняют, для каких осей указан предел.', + true, + ), + _s( + '3.13', + SignCategory.prohibitory, + 'Ограничение высоты', + 'Нельзя ехать, если габаритная высота с грузом или без больше числа на знаке.', + 'Смотрите метры на знаке до путепровода или проезда.', + true, + ), + _s( + '3.14', + SignCategory.prohibitory, + 'Ограничение ширины', + 'Нельзя ехать, если габаритная ширина с грузом или без больше числа на знаке.', + 'Смотрите метры на знаке.', + true, + ), + _s( + '3.15', + SignCategory.prohibitory, + 'Ограничение длины', + 'Нельзя ехать составу или автомобилю, если габаритная длина больше числа на знаке.', + 'Смотрите метры на знаке.', + true, + ), + _s( + '3.16', + SignCategory.prohibitory, + 'Ограничение минимальной дистанции', + 'Нельзя ехать с дистанцией меньше указанной на знаке.', + 'Держите дистанцию не меньше числа на знаке. Зона — до ближайшего перекрёстка, если её не сокращает табличка.', + true, + ), + _s( + '3.17.1', + SignCategory.prohibitory, + 'Таможня', + 'Нельзя проезжать без остановки у таможни или контрольного пункта.', + 'Остановитесь у пункта контроля.', + ), + _s( + '3.17.2', + SignCategory.prohibitory, + 'Опасность', + 'Дальнейшее движение всех транспортных средств запрещено из-за ДТП, аварии, пожара или другой опасности.', + 'Остановитесь и не объезжайте знак.', + ), + _s( + '3.17.3', + SignCategory.prohibitory, + 'Контроль', + 'Нельзя проезжать без остановки через контрольный пункт.', + 'Остановитесь на пункте контроля.', + ), + _s( + '3.18.1', + SignCategory.prohibitory, + 'Поворот направо запрещён', + 'Запрещён поворот направо на ближайшем пересечении проезжих частей.', + 'Не поворачивайте направо на этом пересечении. На маршрутный транспорт запрет не действует.', + ), + _s( + '3.18.2', + SignCategory.prohibitory, + 'Поворот налево запрещён', + 'Запрещён поворот налево на ближайшем пересечении проезжих частей. Разворот этот знак сам по себе не запрещает.', + 'Не поворачивайте налево. Если нужен разворот, проверьте, что его не запрещает другой знак.', + ), + _s( + '3.19', + SignCategory.prohibitory, + 'Разворот запрещён', + 'Запрещён разворот. Поворот налево этот знак не запрещает.', + 'Не разворачивайтесь в этом месте.', + ), + _s( + '3.20', + SignCategory.prohibitory, + 'Обгон запрещён', + 'Нельзя обгонять транспортные средства, кроме тихоходных, гужевых повозок, велосипедов, мопедов и двухколёсных мотоциклов без бокового прицепа.', + 'Не начинайте обгон. Зона — до ближайшего перекрёстка, конца населённого пункта или знака 3.21, если табличка не задаёт меньшую длину.', + ), + _s( + '3.21', + SignCategory.prohibitory, + 'Конец зоны запрещения обгона', + 'Заканчивается зона знака 3.20.', + 'Обгон снова оценивайте по общим правилам, а не по этому знаку.', + ), + _s( + '3.22', + SignCategory.prohibitory, + 'Обгон грузовым автомобилям запрещён', + 'Грузовикам тяжелее 3,5 т запрещён обгон всех транспортных средств.', + 'На таком грузовике не обгоняйте. Конец зоны — знак 3.23 или ближайший перекрёсток.', + ), + _s( + '3.23', + SignCategory.prohibitory, + 'Конец зоны запрещения обгона грузовым автомобилям', + 'Заканчивается зона знака 3.22.', + 'Дальше действует общий порядок обгона для грузовиков.', + ), + _s( + '3.24', + SignCategory.prohibitory, + 'Ограничение максимальной скорости', + 'Нельзя ехать быстрее числа на знаке, км/ч.', + 'Смотрите цифру на знаке. Зона — до ближайшего перекрёстка, другого знака 3.24, знака 3.25 или таблички 8.2.1. Перед населённым пунктом со знаком 5.23 зона действует до этого знака.', + true, + ), + _s( + '3.25', + SignCategory.prohibitory, + 'Конец зоны ограничения максимальной скорости', + 'Заканчивается ограничение, введённое знаком 3.24.', + 'Дальше действует общее ограничение скорости для этой дороги, если нет нового знака.', + ), + _s( + '3.26', + SignCategory.prohibitory, + 'Подача звукового сигнала запрещена', + 'Нельзя сигналить, кроме случая, когда сигнал нужен, чтобы предотвратить ДТП.', + 'Не используйте звуковой сигнал без угрозы аварии.', + ), + _s( + '3.27', + SignCategory.prohibitory, + 'Остановка запрещена', + 'Запрещены и остановка, и стоянка. Только на той стороне, где стоит знак.', + 'Не останавливайтесь от знака до ближайшего перекрёстка, а в населённом пункте без перекрёстка — до его конца. Выезд со двора зону не прерывает. Таблички 8.2.2–8.2.6 могут задать другую зону. Исключение — маршрутный транспорт и такси на обозначенной остановке.', + ), + _s( + '3.28', + SignCategory.prohibitory, + 'Стоянка запрещена', + 'Запрещена стоянка. Короткая остановка, в том числе для посадки пассажира, этим знаком не запрещена.', + 'Не оставляйте автомобиль. Зона такая же, как у знака 3.27: до перекрёстка и только на этой стороне, если табличка не говорит иначе.', + ), + _s( + '3.29', + SignCategory.prohibitory, + 'Стоянка запрещена по нечётным числам месяца', + 'По нечётным числам стоянка запрещена. Остановка разрешена.', + 'В нечётный день не стойте. Если на противоположной стороне стоит 3.30, с 21:00 до 24:00 разрешена стоянка на обеих сторонах — это время перестановки.', + ), + _s( + '3.30', + SignCategory.prohibitory, + 'Стоянка запрещена по чётным числам месяца', + 'По чётным числам стоянка запрещена. Остановка разрешена.', + 'В чётный день не стойте. Если напротив стоит знак 3.29, с 21:00 до 24:00 разрешена стоянка на обеих сторонах.', + ), + _s( + '3.31', + SignCategory.prohibitory, + 'Конец зоны всех ограничений', + 'Одновременно заканчиваются ограничения знаков 3.16, 3.20, 3.22, 3.24 и 3.26–3.30.', + 'Сняты только перечисленные ограничения, а не любые другие знаки.', + ), + _s( + '3.32', + SignCategory.prohibitory, + 'Движение с опасными грузами запрещено', + 'Нельзя ехать транспорту с опознавательным знаком «Опасный груз».', + 'С опасным грузом выберите другой маршрут.', + ), + _s( + '3.33', + SignCategory.prohibitory, + 'Движение с взрывчатыми и легковоспламеняющимися грузами запрещено', + 'Запрещено движение с взрывчатыми веществами и грузами, маркированными как легковоспламеняющиеся, кроме ограниченного количества по специальным правилам.', + 'С таким грузом не въезжайте.', + ), + _s( + '3.34', + SignCategory.prohibitory, + 'Движение автобусов запрещено', + 'Запрещено движение автобусов в обоих направлениях.', + 'Не въезжайте на автобусе. На маршрутные автобусы и школьные автобусы запрет не распространяется.', + ), + _s( + '3.35', + SignCategory.prohibitory, + 'Движение на средствах индивидуальной мобильности запрещено', + 'Запрещено движение на средствах индивидуальной мобильности.', + 'Спешьтесь и ведите средство рядом, если это требуется правилами для пешехода.', + ), + _s( + '4.1.1', + SignCategory.mandatory, + 'Движение прямо', + 'Разрешено движение только прямо. Если знак стоит перед пересечением, он действует на это пересечение. Если в начале участка — до ближайшего перекрёстка и не запрещает поворот направо во двор.', + 'Едьте прямо. На маршрутный транспорт знак не действует.', + ), + _s( + '4.1.2', + SignCategory.mandatory, + 'Движение направо', + 'Разрешено движение только направо.', + 'Поворачивайте направо.', + ), + _s( + '4.1.3', + SignCategory.mandatory, + 'Движение налево', + 'Разрешено движение только налево. Знак, разрешающий поворот налево, разрешает и разворот.', + 'Поворачивайте налево или разворачивайтесь, если разворот здесь возможен по правилам.', + ), + _s( + '4.1.4', + SignCategory.mandatory, + 'Движение прямо или направо', + 'Разрешены только прямо и направо.', + 'Не поворачивайте налево и не разворачивайтесь.', + ), + _s( + '4.1.5', + SignCategory.mandatory, + 'Движение прямо или налево', + 'Разрешены только прямо и налево. Поворот налево разрешает и разворот.', + 'Не поворачивайте направо.', + ), + _s( + '4.1.6', + SignCategory.mandatory, + 'Движение направо или налево', + 'Разрешены только направо и налево. Поворот налево разрешает и разворот.', + 'Прямо ехать нельзя.', + ), + _s( + '4.2.1', + SignCategory.mandatory, + 'Объезд препятствия справа', + 'Объезжать препятствие можно только справа.', + 'Объезжайте справа.', + ), + _s( + '4.2.2', + SignCategory.mandatory, + 'Объезд препятствия слева', + 'Объезжать препятствие можно только слева.', + 'Объезжайте слева.', + ), + _s( + '4.2.3', + SignCategory.mandatory, + 'Объезд препятствия справа или слева', + 'Объезжать препятствие можно с любой стороны.', + 'Выберите свободную сторону объезда.', + ), + _s( + '4.3', + SignCategory.mandatory, + 'Круговое движение', + 'Разрешено движение в направлении стрелок по кругу.', + 'Въезжайте на круг в направлении стрелок. Приоритет определяют знаки 2.1, 2.4 или 2.5 на въезде, а не этот знак.', + ), + _s( + '4.4.1', + SignCategory.mandatory, + 'Велосипедная дорожка', + 'Начинается велосипедная дорожка.', + 'Автомобилем на дорожку не выезжайте.', + ), + _s( + '4.4.2', + SignCategory.mandatory, + 'Конец велосипедной дорожки', + 'Велосипедная дорожка заканчивается.', + 'Дальше двигайтесь по правилам для обычной дороги.', + ), + _s( + '4.5.1', + SignCategory.mandatory, + 'Пешеходная дорожка', + 'Дорожка для пешеходов и средств индивидуальной мобильности. Велосипедистам — только в случаях, которые прямо указаны в пунктах 24.2–24.4 и 24.6 ПДД.', + 'Автомобилем не выезжайте.', + ), + _s( + '4.5.2', + SignCategory.mandatory, + 'Пешеходная и велосипедная дорожка с совмещённым движением', + 'Общая дорожка для пешеходов и велосипедистов.', + 'Автомобилем не выезжайте. Пешеходы и велосипедисты делят одну дорожку.', + ), + _s( + '4.5.3', + SignCategory.mandatory, + 'Конец велопешеходной дорожки с совмещённым движением', + 'Совмещённая дорожка заканчивается.', + 'Дальше смотрите, куда разрешено движение.', + ), + _s( + '4.5.4', + SignCategory.mandatory, + 'Пешеходная и велосипедная дорожка с разделением движения', + 'Дорожка разделена на велосипедную и пешеходную стороны.', + 'Каждый едет по своей стороне. Стороны смотрите на знаке.', + true, + ), + _s( + '4.5.5', + SignCategory.mandatory, + 'Пешеходная и велосипедная дорожка с разделением движения', + 'Дорожка разделена на велосипедную и пешеходную стороны.', + 'Каждый едет по своей стороне. Стороны смотрите на знаке.', + true, + ), + _s( + '4.5.6', + SignCategory.mandatory, + 'Конец велопешеходной дорожки с разделением движения', + 'Разделённая дорожка заканчивается.', + 'Дальше смотрите следующие знаки.', + ), + _s( + '4.5.7', + SignCategory.mandatory, + 'Конец велопешеходной дорожки с разделением движения', + 'Разделённая дорожка заканчивается.', + 'Дальше смотрите следующие знаки.', + ), + _s( + '4.6', + SignCategory.mandatory, + 'Ограничение минимальной скорости', + 'Разрешено движение только со скоростью не ниже числа на знаке, км/ч.', + 'Едьте не медленнее цифры на знаке или уйдите с этой полосы, если знак относится к полосе.', + true, + ), + _s( + '4.7', + SignCategory.mandatory, + 'Конец зоны ограничения минимальной скорости', + 'Заканчивается требование знака 4.6.', + 'Минимальная скорость этим знаком больше не задана.', + ), + _s( + '4.8.1', + SignCategory.mandatory, + 'Направление движения транспортных средств с опасными грузами', + 'Транспорт с знаком «Опасный груз» может ехать только прямо.', + 'С опасным грузом едьте прямо.', + ), + _s( + '4.8.2', + SignCategory.mandatory, + 'Направление движения транспортных средств с опасными грузами', + 'Транспорт с знаком «Опасный груз» может ехать только направо.', + 'С опасным грузом поверните направо.', + ), + _s( + '4.8.3', + SignCategory.mandatory, + 'Направление движения транспортных средств с опасными грузами', + 'Транспорт с знаком «Опасный груз» может ехать только налево.', + 'С опасным грузом поверните налево.', + ), + _s( + '5.1', + SignCategory.special, + 'Автомагистраль', + 'Дорога, на которой действуют требования ПДД к автомагистралям.', + 'Соблюдайте режим автомагистрали: без пешеходов, велосипедов, учебной езды, остановки вне специальных площадок, разворота и движения задним ходом.', + ), + _s( + '5.2', + SignCategory.special, + 'Конец автомагистрали', + 'Требования к автомагистрали дальше не действуют.', + 'Переходите на режим обычной дороги.', + ), + _s( + '5.3', + SignCategory.special, + 'Дорога для автомобилей', + 'Дорога только для автомобилей, автобусов и мотоциклов.', + 'Не выезжайте на тракторе, мопеде, велосипеде и не идите пешком.', + ), + _s( + '5.4', + SignCategory.special, + 'Конец дороги для автомобилей', + 'Заканчивается дорога, обозначенная знаком 5.3.', + 'Дальше действуют общие правила для этой дороги.', + ), + _s( + '5.5', + SignCategory.special, + 'Дорога с односторонним движением', + 'По всей ширине проезжей части механические транспортные средства едут в одну сторону.', + 'Не двигайтесь навстречу потоку. Остановка и стоянка — по общим правилам, на левой стороне есть отдельные условия в ПДД.', + ), + _s( + '5.6', + SignCategory.special, + 'Конец дороги с односторонним движением', + 'Одностороннее движение заканчивается.', + 'Дальше ожидайте встречную полосу.', + ), + _s( + '5.7.1', + SignCategory.special, + 'Выезд на дорогу с односторонним движением', + 'Выезд на одностороннюю дорогу.', + 'Поворачивайте только в направлении, куда разрешает стрелка на знаке.', + true, + ), + _s( + '5.7.2', + SignCategory.special, + 'Выезд на дорогу с односторонним движением', + 'Выезд на одностороннюю дорогу.', + 'Поворачивайте только в направлении, куда разрешает стрелка на знаке.', + true, + ), + _s( + '5.8', + SignCategory.special, + 'Реверсивное движение', + 'На одной или нескольких полосах направление может меняться на противоположное.', + 'Въезжайте на реверсивную полосу только при разрешающем реверсивном светофоре.', + ), + _s( + '5.9', + SignCategory.special, + 'Конец реверсивного движения', + 'Реверсивный участок заканчивается.', + 'Перестройтесь на обычную полосу своего направления.', + ), + _s( + '5.10', + SignCategory.special, + 'Выезд на дорогу с реверсивным движением', + 'Впереди дорога с реверсивным движением.', + 'Смотрите реверсивные светофоры до выезда на такую полосу.', + ), + _s( + '5.11.1', + SignCategory.special, + 'Дорога с полосой для маршрутных транспортных средств', + 'По встречной выделенной полосе едут транспортные средства, допущенные к движению по полосе для маршрутных.', + 'Не выезжайте на встречную выделенную полосу.', + ), + _s( + '5.11.2', + SignCategory.special, + 'Дорога с полосой для велосипедистов', + 'Навстречу общему потоку выделена полоса для велосипедистов, средств индивидуальной мобильности и мопедов.', + 'Не занимайте встречную велосипедную полосу.', + ), + _s( + '5.12.1', + SignCategory.special, + 'Конец дороги с полосой для маршрутных транспортных средств', + 'Заканчивается дорога со встречной полосой для маршрутных транспортных средств.', + 'Дальше смотрите новую схему полос.', + ), + _s( + '5.12.2', + SignCategory.special, + 'Конец дороги с полосой для велосипедистов', + 'Заканчивается дорога со встречной велосипедной полосой.', + 'Дальше смотрите новую схему полос.', + ), + _s( + '5.13.1', + SignCategory.special, + 'Выезд на дорогу с полосой для маршрутных транспортных средств', + 'Выезд на дорогу, где есть полоса для маршрутных транспортных средств.', + 'При повороте не занимайте выделенную полосу. Схему смотрите на знаке.', + true, + ), + _s( + '5.13.2', + SignCategory.special, + 'Выезд на дорогу с полосой для маршрутных транспортных средств', + 'Выезд на дорогу, где есть полоса для маршрутных транспортных средств.', + 'При повороте не занимайте выделенную полосу. Схему смотрите на знаке.', + true, + ), + _s( + '5.14.1', + SignCategory.special, + 'Полоса для маршрутных транспортных средств', + 'Полоса, по которой попутно общему потоку едет транспорт, допущенный на полосу маршрутных.', + 'Не перестраивайтесь на эту полосу. Если знак справа — он относится к правой полосе, если над полосой — к полосе под ним.', + ), + _s( + '5.14.2', + SignCategory.special, + 'Полоса для велосипедистов', + 'Выделенная полоса для велосипедистов.', + 'Автомобилем по этой полосе не едьте.', + ), + _s( + '5.14.3', + SignCategory.special, + 'Конец полосы для маршрутных транспортных средств', + 'Полоса для маршрутных транспортных средств заканчивается.', + 'Дальше полоса обычная, если нет нового знака.', + ), + _s( + '5.14.4', + SignCategory.special, + 'Конец полосы для велосипедистов', + 'Велосипедная полоса заканчивается.', + 'Дальше смотрите разметку и знаки.', + ), + _s( + '5.15.1', + SignCategory.special, + 'Направления движения по полосам', + 'Число полос и разрешённые направления по каждой. Стрелка налево из крайней левой полосы разрешает и разворот.', + 'Займите полосу под свой манёвр. Стрелки смотрите на знаке. На маршрутный транспорт знак не действует.', + true, + ), + _s( + '5.15.2', + SignCategory.special, + 'Направления движения по полосе', + 'Разрешённые направления по конкретной полосе. Поворот налево из крайней левой полосы разрешает и разворот.', + 'С этой полосы едьте только туда, куда показывает стрелка на знаке.', + true, + ), + _s( + '5.15.3', + SignCategory.special, + 'Начало полосы', + 'Начало дополнительной полосы на подъёме или полосы торможения.', + 'Если на знаке есть ограничение минимальной скорости и вы едете медленнее, перестройтесь на полосу справа.', + true, + ), + _s( + '5.15.4', + SignCategory.special, + 'Начало полосы', + 'Начало средней полосы трёхполосной дороги, предназначенной для вашего направления.', + 'Можно перестраиваться на эту полосу, если вставленный в знак запрет не относится к вашему транспорту.', + true, + ), + _s( + '5.15.5', + SignCategory.special, + 'Конец полосы', + 'Заканчивается дополнительная полоса на подъёме или полоса разгона.', + 'Перестройтесь заранее.', + ), + _s( + '5.15.6', + SignCategory.special, + 'Конец полосы', + 'Заканчивается средняя полоса трёхполосной дороги в вашем направлении.', + 'Перестройтесь заранее.', + ), + _s( + '5.15.7', + SignCategory.special, + 'Направление движения по полосам', + 'Направления и возможный запрет для отдельных видов транспорта по полосам.', + 'Смотрите стрелки и вложенные знаки на табличке.', + true, + ), + _s( + '5.15.8', + SignCategory.special, + 'Число полос', + 'Число полос и режим движения по ним. Нужно выполнять требования знаков на стрелках.', + 'Смотрите число полос и символы на знаке.', + true, + ), + _s( + '5.16', + SignCategory.special, + 'Место остановки автобуса и (или) троллейбуса', + 'Остановка автобуса и троллейбуса.', + 'Не останавливайтесь и не стойте в зоне остановки, кроме правил для посадки и высадки, и уступайте автобусу, отъезжающему от остановки, когда этого требуют ПДД.', + ), + _s( + '5.17', + SignCategory.special, + 'Место остановки трамвая', + 'Остановка трамвая.', + 'Пропускайте пассажиров трамвая по правилам проезда остановок и не останавливайтесь в зоне остановки.', + ), + _s( + '5.18', + SignCategory.special, + 'Место стоянки легковых такси', + 'Стоянка легковых такси.', + 'Не занимайте место стоянки такси, если вы не такси.', + ), + _s( + '5.19.1', + SignCategory.special, + 'Пешеходный переход', + 'Ближняя граница пешеходного перехода, знак стоит справа.', + 'Уступите пешеходам, которые переходят или вступили на переход. Снизьте скорость заранее.', + ), + _s( + '5.19.2', + SignCategory.special, + 'Пешеходный переход', + 'Дальняя граница пешеходного перехода, знак стоит слева.', + 'Вы ещё на переходе, пока не миновали этот знак. Уступайте пешеходам на переходе.', + ), + _s( + '5.20', + SignCategory.special, + 'Искусственная неровность', + 'Ближняя граница искусственной неровности.', + 'Снизьте скорость перед неровностью.', + ), + _s( + '5.21', + SignCategory.special, + 'Жилая зона', + 'Территория, где действует порядок движения в жилой зоне.', + 'Пешеходы могут идти по проезжей части, скорость ограничена правилами жилой зоны, сквозной проезд и учебная езда запрещены. Уступайте пешеходам.', + ), + _s( + '5.22', + SignCategory.special, + 'Конец жилой зоны', + 'Жилая зона заканчивается.', + 'Дальше действуют общие правила. Уступите при выезде на дорогу.', + ), + _s( + '5.23.1', + SignCategory.special, + 'Начало населённого пункта', + 'Начало населённого пункта, в котором действуют правила движения в населённых пунктах.', + 'Снизьте скорость до ограничения, установленного для населённого пункта, если знак 3.24 не задаёт иное.', + ), + _s( + '5.23.2', + SignCategory.special, + 'Начало населённого пункта', + 'Начало населённого пункта, в котором действуют правила движения в населённых пунктах. Название нарисовано на знаке.', + 'Снизьте скорость до ограничения для населённого пункта, если отдельный знак скорости не задаёт иное.', + true, + ), + _s( + '5.24.1', + SignCategory.special, + 'Конец населённого пункта', + 'С этого места правила для населённых пунктов на этой дороге не действуют.', + 'Дальше действует ограничение скорости вне населённого пункта, если нет другого знака.', + ), + _s( + '5.24.2', + SignCategory.special, + 'Конец населённого пункта', + 'Конец населённого пункта, обозначенного знаком 5.23.2.', + 'Дальше действует режим дороги вне населённого пункта.', + ), + _s( + '5.25', + SignCategory.special, + 'Начало населённого пункта', + 'Населённый пункт, в котором на этой дороге не действуют правила движения в населённых пунктах.', + 'Скорость населённого пункта этот знак не включает. Название смотрите на знаке.', + true, + ), + _s( + '5.26', + SignCategory.special, + 'Конец населённого пункта', + 'Конец населённого пункта, обозначенного знаком 5.25.', + 'Режим дороги не меняется на «городской» этим знаком, потому что он и не включался.', + ), + _s( + '5.27', + SignCategory.special, + 'Зона с ограничением стоянки', + 'Начинается территория, где стоянка запрещена.', + 'Не стойте до знака 5.28. Остановка при этом может быть разрешена.', + ), + _s( + '5.28', + SignCategory.special, + 'Конец зоны с ограничением стоянки', + 'Заканчивается зона знака 5.27.', + 'Стоянка снова по общим правилам и другим знакам.', + ), + _s( + '5.29', + SignCategory.special, + 'Зона регулируемой стоянки', + 'Территория, где стоянка разрешена и регулируется табличками и разметкой.', + 'Ставьте автомобиль только так, как показывают таблички и разметка.', + true, + ), + _s( + '5.30', + SignCategory.special, + 'Конец зоны регулируемой стоянки', + 'Заканчивается зона знака 5.29.', + 'Дальше стоянка по общим правилам.', + ), + _s( + '5.31', + SignCategory.special, + 'Зона с ограничением максимальной скорости', + 'Территория, где максимальная скорость ограничена числом на знаке.', + 'Едьте не быстрее цифры на знаке до знака 5.32.', + true, + ), + _s( + '5.32', + SignCategory.special, + 'Конец зоны с ограничением максимальной скорости', + 'Заканчивается зона знака 5.31.', + 'Дальше действует общее ограничение, если нет нового знака.', + ), + _s( + '5.33', + SignCategory.special, + 'Пешеходная зона', + 'Территория, где разрешено движение пешеходов, а велосипедистам и средствам индивидуальной мобильности — только в случаях пунктов 24.2–24.4 и 24.6 ПДД.', + 'Автомобилем не въезжайте.', + ), + _s( + '5.34', + SignCategory.special, + 'Конец пешеходной зоны', + 'Пешеходная зона заканчивается.', + 'Дальше смотрите режим дороги.', + ), + _s( + '5.35', + SignCategory.special, + 'Зона с ограничением экологического класса', + 'Нельзя ехать механическим транспортным средствам, у которых экологический класс ниже числа на знаке или не указан в документах.', + 'Сверьте класс в документах с цифрой на знаке. Есть исключения для скорой, пожарных, почты, электромобилей и знака «Инвалид».', + true, + ), + _s( + '5.36', + SignCategory.special, + 'Конец зоны с ограничением экологического класса', + 'Заканчивается зона знака 5.35.', + 'Ограничение по экоклассу снято.', + ), + _s( + '5.37', + SignCategory.special, + 'Зона с ограничением экологического класса по видам транспортных средств', + 'Запрет по экоклассу относится к видам транспорта, нарисованным на знаке.', + 'Смотрите и вид транспорта, и цифру класса на знаке.', + true, + ), + _s( + '5.38', + SignCategory.special, + 'Конец зоны с ограничением экологического класса по видам транспортных средств', + 'Заканчивается зона знака 5.37.', + 'Ограничение снято.', + ), + _s( + '5.39', + SignCategory.special, + 'Велосипедная зона', + 'Начало велосипедной зоны.', + 'Действуют правила велосипедной зоны: автомобили здесь гости, приоритет у велосипедистов. Скорость ограничена правилами этой зоны.', + ), + _s( + '5.40', + SignCategory.special, + 'Конец велосипедной зоны', + 'Велосипедная зона заканчивается.', + 'Дальше обычный режим дороги. При выезде уступите.', + ), + _s( + '6.1', + SignCategory.information, + 'Общие ограничения максимальной скорости', + 'Общие ограничения скорости, установленные ПДД. Конкретные числа нарисованы на знаке.', + 'Это справочный знак, а не новое местное ограничение. Цифры смотрите на знаке.', + true, + ), + _s( + '6.2', + SignCategory.information, + 'Рекомендуемая скорость', + 'Скорость, с которой рекомендуют ехать. Это не запрет ехать быстрее.', + 'Ориентируйтесь на цифру на знаке. Зона — до ближайшего перекрёстка, а вместе с предупреждающим знаком — на длину опасного участка.', + true, + ), + _s( + '6.3.1', + SignCategory.information, + 'Место для разворота', + 'Место, где можно развернуться. Поворот налево здесь запрещён.', + 'Разворот — да, поворот налево — нет.', + ), + _s( + '6.3.2', + SignCategory.information, + 'Зона для разворота', + 'Протяжённость зоны, где можно развернуться. Поворот налево запрещён.', + 'Разворачивайтесь в пределах зоны на знаке. Длину смотрите на знаке.', + true, + ), + _s( + '6.4', + SignCategory.information, + 'Парковка', + 'Парковочное место. Символ «Платные услуги» означает платную парковку, символ «Инвалиды» — только для автомобилей со знаком «Инвалид».', + 'Ставьте автомобиль по табличкам и разметке. У края проезжей части зона идёт до ближайшего перекрёстка или как указывает табличка 8.2.1.', + true, + ), + _s( + '6.5', + SignCategory.information, + 'Полоса аварийной остановки', + 'Полоса аварийной остановки на крутом спуске.', + 'Используйте её только если не удаётся остановить автомобиль обычным торможением.', + ), + _s( + '6.6', + SignCategory.information, + 'Подземный пешеходный переход', + 'Подземный переход.', + 'Пешеходам переходить здесь под землёй, а не по проезжей части.', + ), + _s( + '6.7', + SignCategory.information, + 'Надземный пешеходный переход', + 'Надземный переход.', + 'Пешеходам переходить здесь по мосту, а не по проезжей части.', + ), + _s( + '6.8.1', + SignCategory.information, + 'Тупик', + 'Дорога без сквозного проезда прямо.', + 'Не рассчитывайте на сквозной проезд.', + ), + _s( + '6.8.2', + SignCategory.information, + 'Тупик', + 'Тупик справа, без сквозного проезда.', + 'Не рассчитывайте на сквозной проезд в сторону, которую показывает знак.', + ), + _s( + '6.8.3', + SignCategory.information, + 'Тупик', + 'Тупик слева, без сквозного проезда.', + 'Не рассчитывайте на сквозной проезд в сторону, которую показывает знак.', + ), + _s( + '6.16', + SignCategory.information, + 'Стоп-линия', + 'Место, где нужно остановиться при запрещающем сигнале светофора или регулировщика.', + 'Остановитесь перед этой линией, а не на ней, если сигнал запрещает движение.', + ), + _s( + '6.22', + SignCategory.information, + 'Фотовидеофиксация', + 'Впереди или здесь возможна автоматическая фиксация нарушений.', + 'Знак предупреждает о камере. Он не заменяет ограничения скорости и другие знаки. Вне населённого пункта его ставят за 150–300 м до зоны контроля.', + ), + _s( + '7.1', + SignCategory.service, + 'Пункт медицинской помощи', + 'Рядом пункт медицинской помощи.', + 'Информационный знак, требования к манёвру не добавляет.', + ), + _s( + '7.2', + SignCategory.service, + 'Больница', + 'Рядом больница.', + 'Информационный знак. Не шумите, если рядом есть запрет сигнала.', + ), + _s( + '7.3', + SignCategory.service, + 'Автозаправочная станция', + 'Рядом АЗС.', + 'Информационный знак.', + ), + _s( + '7.4', + SignCategory.service, + 'Техническое обслуживание автомобилей', + 'Рядом станция техобслуживания.', + 'Информационный знак.', + ), + _s( + '7.5', + SignCategory.service, + 'Мойка автомобилей', + 'Рядом мойка.', + 'Информационный знак.', + ), + _s( + '7.7', + SignCategory.service, + 'Пункт питания', + 'Рядом пункт питания.', + 'Информационный знак.', + ), + _s( + '7.12', + SignCategory.service, + 'Пост дорожно-патрульной службы', + 'Рядом пост ДПС.', + 'Информационный знак.', + ), + _s( + '7.19', + SignCategory.service, + 'Телефон экстренной связи', + 'Место телефона для вызова оперативных служб.', + 'Информационный знак.', + ), + _s( + '7.21', + SignCategory.service, + 'Автозаправочная станция с возможностью зарядки электромобилей', + 'АЗС, где можно зарядить электромобиль.', + 'Информационный знак.', + ), + _s( + '8.1.1', + SignCategory.plate, + 'Расстояние до объекта', + 'Расстояние от знака до опасного участка, ограничения или объекта впереди.', + 'Читайте метры на табличке вместе со знаком над ней.', + true, + ), + _s( + '8.2.1', + SignCategory.plate, + 'Зона действия', + 'Протяжённость опасного участка или зона действия запрещающего знака, а также знаков 5.16, 6.2 и 6.4.', + 'Ограничение действует на длину, указанную на табличке, а не «до перекрёстка».', + true, + ), + _s( + '8.2.2', + SignCategory.plate, + 'Зона действия', + 'Зона действия знаков 3.27–3.30.', + 'Смотрите стрелку и метры: они задают, где нельзя останавливаться или стоять.', + true, + ), + _s( + '8.2.3', + SignCategory.plate, + 'Зона действия', + 'Конец зоны знаков 3.27–3.30.', + 'Вместе со знаком 3.27–3.30 показывает, что зона запрета здесь заканчивается.', + ), + _s( + '8.2.4', + SignCategory.plate, + 'Зона действия', + 'Вы уже в зоне знаков 3.27–3.30.', + 'Запрет остановки или стоянки здесь продолжается, он начался раньше.', + ), + _s( + '8.13', + SignCategory.plate, + 'Направление главной дороги', + 'Показывает, как главная дорога проходит через перекрёсток.', + 'Уступайте тем, кто движется по жирной линии на табличке. Схему смотрите на ней.', + true, + ), + _s( + '8.14', + SignCategory.plate, + 'Полоса движения', + 'Знак или светофор относится к указанной полосе.', + 'Смотрите, какая полоса отмечена стрелкой на табличке.', + true, + ), + _s( + '8.15', + SignCategory.plate, + 'Слепые пешеходы', + 'Переходом пользуются слепые пешеходы. Стоит со знаками 1.22, 5.19.1, 5.19.2 или со светофором.', + 'Будьте готовы остановиться, даже если пешеход не смотрит в вашу сторону.', + ), + _s( + '8.16', + SignCategory.plate, + 'Влажное покрытие', + 'Знак над табличкой действует, когда покрытие влажное.', + 'На сухой дороге это ограничение не применяется, на мокрой — применяется.', + ), + _s( + '8.17', + SignCategory.plate, + 'Инвалиды', + 'Со знаком 6.4 парковка только для мотоколясок и автомобилей со знаком «Инвалид».', + 'Без знака «Инвалид» здесь не стойте.', + ), + _s( + '8.18', + SignCategory.plate, + 'Кроме инвалидов', + 'Знак не действует на мотоколяски и автомобили со знаком «Инвалид».', + 'Если знака «Инвалид» нет, выполняйте основной знак.', + ), + _s( + '8.22.1', + SignCategory.plate, + 'Препятствие', + 'Направление объезда препятствия. Применяется со знаками 4.2.1–4.2.3.', + 'Объезжайте в сторону, которую показывает табличка вместе со знаком объезда.', + true, + ), + _s( + '8.22.2', + SignCategory.plate, + 'Препятствие', + 'Направление объезда препятствия.', + 'Объезжайте в сторону, которую показывает табличка.', + true, + ), + _s( + '8.22.3', + SignCategory.plate, + 'Препятствие', + 'Направление объезда препятствия.', + 'Объезжайте в сторону, которую показывает табличка.', + true, + ), + _s( + '8.24', + SignCategory.plate, + 'Работает эвакуатор', + 'В зоне знаков 3.27–3.30 автомобиль могут задержать.', + 'Не оставляйте машину в этой зоне: кроме штрафа возможна эвакуация.', + ), + _s( + 'signal.red', + SignCategory.signal, + 'Красный сигнал светофора', + 'Горит красный сигнал.', + 'Остановитесь. Движение на красный запрещено.', + ), + _s( + 'signal.yellow', + SignCategory.signal, + 'Жёлтый сигнал светофора', + 'Горит жёлтый сигнал. Он запрещает движение и предупреждает, что сигнал сейчас сменится.', + 'Остановитесь перед стоп-линией, если это можно сделать без экстренного торможения. Если остановиться уже нельзя, действуйте по пункту 6.14 ПДД.', + ), + _s( + 'signal.green', + SignCategory.signal, + 'Зелёный сигнал светофора', + 'Горит зелёный сигнал.', + 'Можно ехать. Уступите тем, кто завершает проезд перекрёстка, и пешеходов, которые ещё на переходе.', + ), + _s( + 'signal.redYellow', + SignCategory.signal, + 'Красный и жёлтый сигналы вместе', + 'Красный и жёлтый горят одновременно. Это всё ещё запрещающий сигнал, зелёный включится следом.', + 'Оставайтесь на месте. Начинайте движение, когда загорится зелёный.', + ), + _s( + 'signal.unknown', + SignCategory.signal, + 'Светофор', + 'В кадре светофор. Модель не назвала цвет сигнала.', + 'Выполняйте тот сигнал, который горит сейчас. Цвет с этой карточки не берите.', + ), +]; diff --git a/lib/data/catalog/sign_image_assets.dart b/lib/data/catalog/sign_image_assets.dart new file mode 100644 index 0000000..11645a7 --- /dev/null +++ b/lib/data/catalog/sign_image_assets.dart @@ -0,0 +1,219 @@ +// Generated by tools/fetch_drom_sign_svgs.py. +const Set signImageAssets = { + '1.1', + '1.2', + '1.3.1', + '1.3.2', + '1.4.1', + '1.4.2', + '1.4.3', + '1.4.4', + '1.4.5', + '1.4.6', + '1.5', + '1.6', + '1.7', + '1.8', + '1.9', + '1.10', + '1.11.1', + '1.11.2', + '1.12.1', + '1.12.2', + '1.13', + '1.14', + '1.15', + '1.16', + '1.17', + '1.18', + '1.19', + '1.20.1', + '1.20.2', + '1.20.3', + '1.21', + '1.22', + '1.23', + '1.24', + '1.25', + '1.26', + '1.27', + '1.28', + '1.29', + '1.30', + '1.31', + '1.32', + '1.33', + '1.34.1', + '1.34.2', + '1.34.3', + '1.35', + '2.1', + '2.2', + '2.3.1', + '2.3.2', + '2.3.3', + '2.3.4', + '2.3.5', + '2.3.6', + '2.3.7', + '2.4', + '2.5', + '2.6', + '2.7', + '3.1', + '3.2', + '3.3', + '3.4', + '3.5', + '3.6', + '3.7', + '3.8', + '3.9', + '3.10', + '3.11', + '3.12', + '3.13', + '3.14', + '3.15', + '3.16', + '3.17.1', + '3.17.2', + '3.17.3', + '3.18.1', + '3.18.2', + '3.19', + '3.20', + '3.21', + '3.22', + '3.23', + '3.24', + '3.25', + '3.26', + '3.27', + '3.28', + '3.29', + '3.30', + '3.31', + '3.32', + '3.33', + '3.34', + '3.35', + '4.1.1', + '4.1.2', + '4.1.3', + '4.1.4', + '4.1.5', + '4.1.6', + '4.2.1', + '4.2.2', + '4.2.3', + '4.3', + '4.4.1', + '4.4.2', + '4.5.1', + '4.5.2', + '4.5.3', + '4.5.4', + '4.5.5', + '4.5.6', + '4.5.7', + '4.6', + '4.7', + '4.8.1', + '4.8.2', + '4.8.3', + '5.1', + '5.2', + '5.3', + '5.4', + '5.5', + '5.6', + '5.7.1', + '5.7.2', + '5.8', + '5.9', + '5.10', + '5.11.1', + '5.11.2', + '5.12.1', + '5.12.2', + '5.13.1', + '5.13.2', + '5.14.1', + '5.14.2', + '5.14.3', + '5.14.4', + '5.15.1', + '5.15.2', + '5.15.3', + '5.15.4', + '5.15.5', + '5.15.6', + '5.15.7', + '5.15.8', + '5.16', + '5.17', + '5.18', + '5.19.1', + '5.19.2', + '5.20', + '5.21', + '5.22', + '5.23.1', + '5.23.2', + '5.24.1', + '5.24.2', + '5.25', + '5.26', + '5.27', + '5.28', + '5.29', + '5.30', + '5.31', + '5.32', + '5.33', + '5.34', + '5.35', + '5.36', + '5.37', + '5.38', + '5.39', + '5.40', + '6.1', + '6.2', + '6.3.1', + '6.3.2', + '6.4', + '6.5', + '6.6', + '6.7', + '6.8.1', + '6.8.2', + '6.8.3', + '6.16', + '6.22', + '7.1', + '7.2', + '7.3', + '7.4', + '7.5', + '7.7', + '7.12', + '7.19', + '7.21', + '8.1.1', + '8.2.1', + '8.2.2', + '8.2.3', + '8.2.4', + '8.13', + '8.14', + '8.15', + '8.16', + '8.17', + '8.18', + '8.22.1', + '8.22.2', + '8.22.3', + '8.24', +}; diff --git a/lib/data/detection/detector_worker.dart b/lib/data/detection/detector_worker.dart new file mode 100644 index 0000000..d76bafa --- /dev/null +++ b/lib/data/detection/detector_worker.dart @@ -0,0 +1,290 @@ +import 'dart:async'; +import 'dart:isolate'; +import 'dart:typed_data'; + +import 'package:tflite_flutter/tflite_flutter.dart'; + +import '../../domain/letterbox.dart'; +import '../../domain/norm_rect.dart'; +import '../../domain/rotation.dart'; +import '../../domain/yolo_decoder.dart'; +import '../frame/yuv_sampler.dart'; + +class FrameHit { + const FrameHit({ + required this.label, + required this.confidence, + required this.box, + }); + + final String label; + final double confidence; + final NormRect box; +} + +class FrameOutcome { + const FrameOutcome({required this.hits, required this.elapsedMs}); + + final List hits; + final int elapsedMs; +} + +class DetectorWorker { + Isolate? _isolate; + SendPort? _send; + final ReceivePort _incoming = ReceivePort(); + StreamSubscription? _subscription; + final Map> _pending = {}; + var _nextId = 0; + var _ready = false; + + bool get isReady => _ready; + + Future start({ + required Uint8List modelBytes, + required List labels, + }) async { + _isolate = await Isolate.spawn(detectorIsolateMain, _incoming.sendPort); + final sendCompleter = Completer(); + _subscription = _incoming.listen((message) { + if (message is SendPort) { + if (!sendCompleter.isCompleted) { + sendCompleter.complete(message); + } + return; + } + _onMessage(message); + }); + _send = await sendCompleter.future; + final id = _nextId++; + final pending = Completer(); + _pending[id] = pending; + _send!.send(_LoadModel(id, modelBytes, labels)); + final inputSize = await pending.future; + _ready = true; + return inputSize as int; + } + + Future detect({ + required YuvFrame frame, + required int clockwiseDegrees, + required double confidenceThreshold, + double iouThreshold = 0.45, + }) { + final send = _send; + if (send == null || !_ready) { + return Future.error(StateError('Детектор не загружен')); + } + final id = _nextId++; + final pending = Completer(); + _pending[id] = pending; + send.send( + _FrameJob( + id: id, + frame: frame, + clockwiseDegrees: clockwiseDegrees, + confidenceThreshold: confidenceThreshold, + iouThreshold: iouThreshold, + ), + ); + return pending.future.then((value) => value as FrameOutcome); + } + + void _onMessage(Object? message) { + if (message is _Ready) { + _pending.remove(message.id)?.complete(message.inputSize); + return; + } + if (message is _FrameDone) { + _pending + .remove(message.id) + ?.complete( + FrameOutcome(hits: message.hits, elapsedMs: message.elapsedMs), + ); + return; + } + if (message is _Failed) { + _pending.remove(message.id)?.completeError(StateError(message.reason)); + } + } + + Future dispose() async { + _isolate?.kill(priority: Isolate.immediate); + await _subscription?.cancel(); + _incoming.close(); + _isolate = null; + _send = null; + _ready = false; + } +} + +class _LoadModel { + const _LoadModel(this.id, this.bytes, this.labels); + + final int id; + final Uint8List bytes; + final List labels; +} + +class _FrameJob { + const _FrameJob({ + required this.id, + required this.frame, + required this.clockwiseDegrees, + required this.confidenceThreshold, + required this.iouThreshold, + }); + + final int id; + final YuvFrame frame; + final int clockwiseDegrees; + final double confidenceThreshold; + final double iouThreshold; +} + +class _Ready { + const _Ready(this.id, this.inputSize); + + final int id; + final int inputSize; +} + +class _FrameDone { + const _FrameDone(this.id, this.hits, this.elapsedMs); + + final int id; + final List hits; + final int elapsedMs; +} + +class _Failed { + const _Failed(this.id, this.reason); + + final int id; + final String reason; +} + +void detectorIsolateMain(SendPort mainPort) { + final inbox = ReceivePort(); + mainPort.send(inbox.sendPort); + const decoder = YoloDecoder(); + final sampler = YuvSampler(); + Interpreter? interpreter; + List labels = const []; + var inputSize = 0; + List outputShape = const []; + Uint8List? inputBytes; + Uint8List? outputBytes; + + inbox.listen((message) { + if (message is _LoadModel) { + try { + final options = InterpreterOptions()..threads = 4; + final created = Interpreter.fromBuffer(message.bytes, options: options); + final inputTensor = created.getInputTensors().first; + final outputTensor = created.getOutputTensors().first; + if (inputTensor.type != TensorType.float32 || + outputTensor.type != TensorType.float32) { + created.close(); + mainPort.send( + _Failed( + message.id, + 'Нужна модель float32. Экспортируйте без half и без int8.', + ), + ); + return; + } + final shape = inputTensor.shape; + if (shape.length != 4 || shape[3] != 3 || shape[1] != shape[2]) { + created.close(); + mainPort.send( + _Failed( + message.id, + 'Ожидался вход NHWC [1, N, N, 3], получено $shape.', + ), + ); + return; + } + interpreter = created; + labels = message.labels; + inputSize = shape[1]; + outputShape = outputTensor.shape; + inputBytes = Uint8List(inputSize * inputSize * 3 * 4); + final elements = outputShape.fold(1, (a, b) => a * b); + outputBytes = Uint8List(elements * 4); + mainPort.send(_Ready(message.id, inputSize)); + } catch (error) { + mainPort.send(_Failed(message.id, '$error')); + } + return; + } + + if (message is! _FrameJob) { + return; + } + final current = interpreter; + final input = inputBytes; + final output = outputBytes; + if (current == null || input == null || output == null) { + mainPort.send(_Failed(message.id, 'Модель не загружена')); + return; + } + try { + final started = DateTime.now().microsecondsSinceEpoch; + final floats = sampler.sample( + frame: message.frame, + clockwiseDegrees: message.clockwiseDegrees, + inputSize: inputSize, + ); + input.setAll( + 0, + floats.buffer.asUint8List(floats.offsetInBytes, floats.lengthInBytes), + ); + current.run(input, output); + final scores = Float32List.view(output.buffer); + final boxes = decoder.decode( + data: scores, + shape: outputShape, + inputSize: inputSize, + confidenceThreshold: message.confidenceThreshold, + iouThreshold: message.iouThreshold, + ); + final upright = uprightSize( + rawWidth: message.frame.width, + rawHeight: message.frame.height, + clockwiseDegrees: message.clockwiseDegrees, + ); + final letterbox = Letterbox.fit( + srcWidth: upright.$1, + srcHeight: upright.$2, + inputSize: inputSize, + ); + final hits = [ + for (final box in boxes) + FrameHit( + label: box.classIndex >= 0 && box.classIndex < labels.length + ? labels[box.classIndex] + : 'class_${box.classIndex}', + confidence: box.score, + box: _toUpright(box, letterbox, upright.$1, upright.$2), + ), + ]; + final elapsedMs = + ((DateTime.now().microsecondsSinceEpoch - started) / 1000).round(); + mainPort.send(_FrameDone(message.id, hits, elapsedMs)); + } catch (error) { + mainPort.send(_Failed(message.id, '$error')); + } + }); +} + +NormRect _toUpright(YoloBox box, Letterbox letterbox, int width, int height) { + double nx(double value) => (value - letterbox.padX) / letterbox.scale / width; + double ny(double value) => + (value - letterbox.padY) / letterbox.scale / height; + final left = nx(box.left); + final top = ny(box.top); + final right = nx(box.right); + final bottom = ny(box.bottom); + return NormRect(left, top, right - left, bottom - top).clamped(); +} diff --git a/lib/data/frame/yuv_sampler.dart b/lib/data/frame/yuv_sampler.dart new file mode 100644 index 0000000..2af864f --- /dev/null +++ b/lib/data/frame/yuv_sampler.dart @@ -0,0 +1,110 @@ +import 'dart:typed_data'; + +import '../../domain/letterbox.dart'; +import '../../domain/rotation.dart'; + +class YuvFrame { + const YuvFrame({ + required this.width, + required this.height, + required this.y, + required this.u, + required this.v, + required this.yRowStride, + required this.yPixelStride, + required this.uvRowStride, + required this.uvPixelStride, + }); + + final int width; + final int height; + final Uint8List y; + final Uint8List u; + final Uint8List v; + final int yRowStride; + final int yPixelStride; + final int uvRowStride; + final int uvPixelStride; +} + +/// Samples a camera frame directly into a square NHWC float tensor. +/// +/// Padding uses 114/255, the letterbox color Ultralytics trains with. +class YuvSampler { + Float32List sample({ + required YuvFrame frame, + required int clockwiseDegrees, + required int inputSize, + }) { + final upright = uprightSize( + rawWidth: frame.width, + rawHeight: frame.height, + clockwiseDegrees: clockwiseDegrees, + ); + final letterbox = Letterbox.fit( + srcWidth: upright.$1, + srcHeight: upright.$2, + inputSize: inputSize, + ); + final output = Float32List(inputSize * inputSize * 3); + var offset = 0; + for (var dy = 0; dy < inputSize; dy++) { + for (var dx = 0; dx < inputSize; dx++) { + final source = letterbox.uprightFromModelPixel(dx, dy); + final ux = source.$1.floor(); + final uy = source.$2.floor(); + if (ux < 0 || uy < 0 || ux >= upright.$1 || uy >= upright.$2) { + output[offset++] = _pad; + output[offset++] = _pad; + output[offset++] = _pad; + continue; + } + final raw = rawPixelFromUpright( + ux: ux, + uy: uy, + rawWidth: frame.width, + rawHeight: frame.height, + clockwiseDegrees: clockwiseDegrees, + ); + final rgb = _rgbAt(frame, raw.$1, raw.$2); + output[offset++] = rgb.$1; + output[offset++] = rgb.$2; + output[offset++] = rgb.$3; + } + } + return output; + } + + static const double _pad = 114 / 255; + + (double, double, double) _rgbAt(YuvFrame frame, int x, int y) { + final yIndex = y * frame.yRowStride + x * frame.yPixelStride; + final uvX = x >> 1; + final uvY = y >> 1; + final uvIndex = uvY * frame.uvRowStride + uvX * frame.uvPixelStride; + final yp = _byte(frame.y, yIndex, 0); + final up = _byte(frame.u, uvIndex, 128) - 128; + final vp = _byte(frame.v, uvIndex, 128) - 128; + final r = _clamp8(yp + ((1436 * vp) >> 10)); + final g = _clamp8(yp - ((352 * up + 731 * vp) >> 10)); + final b = _clamp8(yp + ((1815 * up) >> 10)); + return (r / 255, g / 255, b / 255); + } + + int _byte(Uint8List plane, int index, int fallback) { + if (index < 0 || index >= plane.length) { + return fallback; + } + return plane[index]; + } + + int _clamp8(int value) { + if (value < 0) { + return 0; + } + if (value > 255) { + return 255; + } + return value; + } +} diff --git a/lib/domain/detection_stabilizer.dart b/lib/domain/detection_stabilizer.dart new file mode 100644 index 0000000..e5cf6d3 --- /dev/null +++ b/lib/domain/detection_stabilizer.dart @@ -0,0 +1,110 @@ +import 'norm_rect.dart'; +import 'traffic_sign.dart'; + +class SignDetection { + const SignDetection({ + required this.rawLabel, + required this.confidence, + required this.box, + this.sign, + }); + + final String rawLabel; + final double confidence; + final NormRect box; + final TrafficSign? sign; + + String get titleCode => sign?.code ?? rawLabel; +} + +/// Keeps a sign on screen only after it has been seen on several frames. +class DetectionStabilizer { + DetectionStabilizer({ + this.minHits = 2, + this.holdMisses = 1, + this.maxMisses = 3, + this.iouThreshold = 0.3, + }); + + final int minHits; + final int holdMisses; + final int maxMisses; + final double iouThreshold; + + final List<_Track> _tracks = []; + + void reset() => _tracks.clear(); + + List update(List frame) { + final matched = {}; + for (final track in _tracks) { + var bestIndex = -1; + var bestIou = iouThreshold; + for (var i = 0; i < frame.length; i++) { + if (matched.contains(i)) { + continue; + } + if (frame[i].rawLabel != track.rawLabel) { + continue; + } + final overlap = rectIou(track.box, frame[i].box); + if (overlap >= bestIou) { + bestIou = overlap; + bestIndex = i; + } + } + if (bestIndex >= 0) { + matched.add(bestIndex); + final detection = frame[bestIndex]; + track + ..hits += 1 + ..misses = 0 + ..confidence = detection.confidence + ..box = track.box.lerp(detection.box, 0.65) + ..sign = detection.sign; + } else { + track.misses += 1; + } + } + + for (var i = 0; i < frame.length; i++) { + if (!matched.contains(i)) { + _tracks.add(_Track(frame[i])); + } + } + _tracks.removeWhere((track) => track.misses > maxMisses); + + final visible = []; + for (final track in _tracks) { + if (track.hits >= minHits && track.misses <= holdMisses) { + visible.add(track.toDetection()); + } + } + visible.sort((a, b) => b.confidence.compareTo(a.confidence)); + return visible; + } +} + +class _Track { + _Track(SignDetection detection) + : rawLabel = detection.rawLabel, + box = detection.box, + confidence = detection.confidence, + sign = detection.sign; + + final String rawLabel; + NormRect box; + double confidence; + TrafficSign? sign; + int hits = 1; + int misses = 0; + + SignDetection toDetection() { + return SignDetection( + rawLabel: rawLabel, + confidence: confidence, + box: box, + sign: sign, + ); + } +} diff --git a/lib/domain/letterbox.dart b/lib/domain/letterbox.dart new file mode 100644 index 0000000..b059611 --- /dev/null +++ b/lib/domain/letterbox.dart @@ -0,0 +1,39 @@ +import 'dart:math' as math; + +/// Ultralytics-style letterbox: fit the source into a square without stretching. +class Letterbox { + const Letterbox({ + required this.inputSize, + required this.scale, + required this.padX, + required this.padY, + }); + + final int inputSize; + final double scale; + final double padX; + final double padY; + + factory Letterbox.fit({ + required int srcWidth, + required int srcHeight, + required int inputSize, + }) { + final scale = math.min(inputSize / srcWidth, inputSize / srcHeight); + return Letterbox( + inputSize: inputSize, + scale: scale, + padX: (inputSize - srcWidth * scale) / 2, + padY: (inputSize - srcHeight * scale) / 2, + ); + } + + /// Center of a model pixel, in upright source pixels. May fall outside the image. + (double x, double y) uprightFromModelPixel(int dx, int dy) { + return ((dx + 0.5 - padX) / scale, (dy + 0.5 - padY) / scale); + } + + (double x, double y) uprightFromModel(double mx, double my) { + return ((mx - padX) / scale, (my - padY) / scale); + } +} diff --git a/lib/domain/norm_rect.dart b/lib/domain/norm_rect.dart new file mode 100644 index 0000000..866f0ca --- /dev/null +++ b/lib/domain/norm_rect.dart @@ -0,0 +1,53 @@ +/// Axis-aligned box in normalized image space, origin at the top-left. +class NormRect { + const NormRect(this.left, this.top, this.width, this.height); + + final double left; + final double top; + final double width; + final double height; + + double get right => left + width; + double get bottom => top + height; + + NormRect clamped() { + final l = left.clamp(0.0, 1.0); + final t = top.clamp(0.0, 1.0); + final r = right.clamp(0.0, 1.0); + final b = bottom.clamp(0.0, 1.0); + return NormRect(l, t, (r - l).clamp(0.0, 1.0), (b - t).clamp(0.0, 1.0)); + } + + NormRect lerp(NormRect other, double t) { + double mix(double a, double b) => a + (b - a) * t; + return NormRect( + mix(left, other.left), + mix(top, other.top), + mix(width, other.width), + mix(height, other.height), + ); + } + + /// Horizontal mirror used for the mirrored front-camera preview. + NormRect mirroredHorizontally() { + return NormRect(1 - right, top, width, height); + } +} + +double rectIou(NormRect a, NormRect b) { + final interLeft = a.left > b.left ? a.left : b.left; + final interTop = a.top > b.top ? a.top : b.top; + final interRight = a.right < b.right ? a.right : b.right; + final interBottom = a.bottom < b.bottom ? a.bottom : b.bottom; + final w = interRight - interLeft; + final h = interBottom - interTop; + if (w <= 0 || h <= 0) { + return 0; + } + final inter = w * h; + final union = a.width * a.height + b.width * b.height - inter; + if (union <= 0) { + return 0; + } + return inter / union; +} diff --git a/lib/domain/rotation.dart b/lib/domain/rotation.dart new file mode 100644 index 0000000..9cc575d --- /dev/null +++ b/lib/domain/rotation.dart @@ -0,0 +1,59 @@ +/// Clockwise degrees that turn a camera buffer upright on screen. +/// +/// Same compensation ML Kit uses for the Android camera plugin: +/// back camera `(sensor - device) mod 360`, front camera `(sensor + device) mod 360`. +int uprightClockwiseDegrees({ + required int sensorOrientation, + required int deviceDegrees, + required bool frontCamera, +}) { + if (frontCamera) { + return (sensorOrientation + deviceDegrees) % 360; + } + return (sensorOrientation - deviceDegrees + 360) % 360; +} + +/// Maps a pixel of the upright image back to the raw camera buffer. +(int x, int y) rawPixelFromUpright({ + required int ux, + required int uy, + required int rawWidth, + required int rawHeight, + required int clockwiseDegrees, +}) { + switch (clockwiseDegrees) { + case 0: + return (ux, uy); + case 90: + // destX = rawHeight - 1 - ry, destY = rx + return (uy, rawHeight - 1 - ux); + case 180: + return (rawWidth - 1 - ux, rawHeight - 1 - uy); + case 270: + // destX = ry, destY = rawWidth - 1 - rx + return (rawWidth - 1 - uy, ux); + default: + throw ArgumentError( + 'Поворот должен быть 0, 90, 180 или 270, получено $clockwiseDegrees', + ); + } +} + +(int width, int height) uprightSize({ + required int rawWidth, + required int rawHeight, + required int clockwiseDegrees, +}) { + switch (clockwiseDegrees) { + case 0: + case 180: + return (rawWidth, rawHeight); + case 90: + case 270: + return (rawHeight, rawWidth); + default: + throw ArgumentError( + 'Поворот должен быть 0, 90, 180 или 270, получено $clockwiseDegrees', + ); + } +} diff --git a/lib/domain/sign_catalog.dart b/lib/domain/sign_catalog.dart new file mode 100644 index 0000000..4f7e46c --- /dev/null +++ b/lib/domain/sign_catalog.dart @@ -0,0 +1,84 @@ +import 'traffic_sign.dart'; +import 'sign_code.dart'; + +class SignCatalog { + SignCatalog(List signs) + : _byCode = {for (final sign in signs) sign.code: sign} { + final seen = {}; + for (final sign in signs) { + if (!seen.add(sign.code)) { + throw ArgumentError('Повторяющийся номер знака: ${sign.code}'); + } + } + } + + final Map _byCode; + + List get signs { + final values = _byCode.values.toList(); + values.sort((a, b) => compareSignCodes(a.code, b.code)); + return values; + } + + TrafficSign? findByCode(String code) => _byCode[code]; + + /// Returns a catalog entry only for a known sign number or a traffic-light + /// class from the training set. Unknown labels stay empty on purpose. + TrafficSign? findByLabel(String rawLabel) { + final signalCode = _trafficSignalCodes[rawLabel.trim().toLowerCase()]; + if (signalCode != null) { + return _byCode[signalCode]; + } + final code = normalizeSignCode(rawLabel); + if (code == null) { + return null; + } + // The dataset splits one speed-limit sign into 3.24.1, 3.24.2, … + // Those suffixes are not speeds and not GOST numbers. + if (_speedLimitVariant.hasMatch(code)) { + return _byCode['3.24']; + } + return _byCode[code]; + } + + List byCategory(SignCategory category) { + return signs.where((sign) => sign.category == category).toList(); + } +} + +final RegExp _speedLimitVariant = RegExp(r'^3\.24(?:\.\d+)+$'); + +/// Class names from Dognellaf/russian-road-signs. Keys are lowercase. +const Map _trafficSignalCodes = { + 'redtrafficlights': 'signal.red', + 'yellowtrafficlights': 'signal.yellow', + 'greentrafficlights': 'signal.green', + 'redyellowtrafficlights': 'signal.redYellow', + 'trafficlights': 'signal.unknown', +}; + +int compareSignCodes(String a, String b) { + final aParts = a.split('.'); + final bParts = b.split('.'); + final length = aParts.length > bParts.length ? aParts.length : bParts.length; + for (var i = 0; i < length; i++) { + final aText = i < aParts.length ? aParts[i] : ''; + final bText = i < bParts.length ? bParts[i] : ''; + final aNumber = int.tryParse(aText); + final bNumber = int.tryParse(bText); + if (aNumber != null && bNumber != null && aNumber != bNumber) { + return aNumber.compareTo(bNumber); + } + if (aNumber != null && bNumber == null) { + return -1; + } + if (aNumber == null && bNumber != null) { + return 1; + } + final textOrder = aText.compareTo(bText); + if (textOrder != 0) { + return textOrder; + } + } + return 0; +} diff --git a/lib/domain/sign_code.dart b/lib/domain/sign_code.dart new file mode 100644 index 0000000..fbdce4d --- /dev/null +++ b/lib/domain/sign_code.dart @@ -0,0 +1,10 @@ +final RegExp _signCodePattern = RegExp(r'\d+(?:\.\d+)+'); + +/// Pulls a GOST/ПДД number out of a model label. +/// +/// `3.27`, `3_27` and `sign-3.27` all become `3.27`. +/// Labels without a dotted number return null: the app must not guess a rule. +String? normalizeSignCode(String rawLabel) { + final unified = rawLabel.trim().replaceAll('_', '.').replaceAll('-', '.'); + return _signCodePattern.firstMatch(unified)?.group(0); +} diff --git a/lib/domain/traffic_sign.dart b/lib/domain/traffic_sign.dart new file mode 100644 index 0000000..bfebf20 --- /dev/null +++ b/lib/domain/traffic_sign.dart @@ -0,0 +1,36 @@ +enum SignCategory { + warning, + priority, + prohibitory, + mandatory, + special, + information, + service, + plate, + signal, +} + +class TrafficSign { + const TrafficSign({ + required this.code, + required this.name, + required this.category, + required this.summary, + required this.action, + this.requiresReadingTheSign = false, + }); + + /// Номер по приложению 1 к ПДД, например `3.27`. + final String code; + final String name; + final SignCategory category; + + /// Что означает знак. + final String summary; + + /// Что делать водителю. Формулировка короче текста ПДД и не заменяет его. + final String action; + + /// На знаке есть число или схема, без которых тип знака не задаёт требование полностью. + final bool requiresReadingTheSign; +} diff --git a/lib/domain/yolo_decoder.dart b/lib/domain/yolo_decoder.dart new file mode 100644 index 0000000..5bd3d01 --- /dev/null +++ b/lib/domain/yolo_decoder.dart @@ -0,0 +1,239 @@ +import 'dart:math' as math; +import 'dart:typed_data'; + +class YoloBox { + const YoloBox({ + required this.left, + required this.top, + required this.right, + required this.bottom, + required this.classIndex, + required this.score, + }); + + final double left; + final double top; + final double right; + final double bottom; + final int classIndex; + final double score; + + double get width => right - left; + double get height => bottom - top; +} + +/// Decodes an Ultralytics YOLO detect head from a TFLite output tensor. +/// +/// Supports the raw head `[1, 4+classes, anchors]` (or transposed) and an +/// end-to-end NMS head `[1, detections, 6]`. Coordinates are returned in +/// model-input pixels. +class YoloDecoder { + const YoloDecoder({this.maxDetections = 8}); + + final int maxDetections; + + static const int nmsFeatureCount = 6; + static const int nmsMaxRows = 300; + + List decode({ + required Float32List data, + required List shape, + required int inputSize, + required double confidenceThreshold, + required double iouThreshold, + }) { + if (shape.length != 3 || shape[0] != 1) { + throw FormatException( + 'Ожидался выход YOLO формы [1, A, B], получено $shape', + ); + } + final dimA = shape[1]; + final dimB = shape[2]; + if (data.length < dimA * dimB) { + throw FormatException('Буфер выхода короче, чем форма $shape'); + } + + if (_isNmsLayout(dimA, dimB)) { + return _decodeNms( + data: data, + rows: dimA, + confidenceThreshold: confidenceThreshold, + inputSize: inputSize, + ); + } + + final channelsFirst = dimA < dimB; + final numChannels = channelsFirst ? dimA : dimB; + final numAnchors = channelsFirst ? dimB : dimA; + if (numChannels < 5) { + throw FormatException('В выходе YOLO меньше 5 каналов: $shape'); + } + + double at(int channel, int anchor) { + if (channelsFirst) { + return data[channel * numAnchors + anchor]; + } + return data[anchor * numChannels + channel]; + } + + var maxCoord = 0.0; + var scoresLookLikeLogits = false; + for (var anchor = 0; anchor < numAnchors; anchor++) { + for (var channel = 0; channel < 4; channel++) { + final value = at(channel, anchor).abs(); + if (value > maxCoord) { + maxCoord = value; + } + } + for (var channel = 4; channel < numChannels; channel++) { + final score = at(channel, anchor); + if (score < 0 || score > 1) { + scoresLookLikeLogits = true; + } + } + } + final coordScale = maxCoord <= 2 ? inputSize.toDouble() : 1.0; + + final candidates = []; + for (var anchor = 0; anchor < numAnchors; anchor++) { + var bestClass = 0; + var bestScore = 0.0; + for (var classIndex = 0; classIndex < numChannels - 4; classIndex++) { + final raw = at(4 + classIndex, anchor); + final score = scoresLookLikeLogits ? _sigmoid(raw) : raw; + if (score > bestScore) { + bestScore = score; + bestClass = classIndex; + } + } + if (bestScore < confidenceThreshold) { + continue; + } + final cx = at(0, anchor) * coordScale; + final cy = at(1, anchor) * coordScale; + final w = at(2, anchor) * coordScale; + final h = at(3, anchor) * coordScale; + if (w < 4 || h < 4) { + continue; + } + candidates.add( + YoloBox( + left: cx - w / 2, + top: cy - h / 2, + right: cx + w / 2, + bottom: cy + h / 2, + classIndex: bestClass, + score: bestScore, + ), + ); + } + + return _nms(candidates, iouThreshold); + } + + /// End-to-end NMS export is `[1, detections, 6]` with at most 300 rows. + /// A raw 2-class head is `[1, 6, anchors]`; at 320 px there are far more + /// than 300 anchors, so the two layouts do not collide. + bool _isNmsLayout(int dimA, int dimB) { + return dimB == nmsFeatureCount && dimA <= nmsMaxRows; + } + + List _decodeNms({ + required Float32List data, + required int rows, + required double confidenceThreshold, + required int inputSize, + }) { + double at(int row, int feature) { + return data[row * nmsFeatureCount + feature]; + } + + var maxCoord = 0.0; + for (var row = 0; row < rows; row++) { + for (var feature = 0; feature < 4; feature++) { + final value = at(row, feature).abs(); + if (value > maxCoord) { + maxCoord = value; + } + } + } + final coordScale = maxCoord <= 2 ? inputSize.toDouble() : 1.0; + final boxes = []; + for (var row = 0; row < rows; row++) { + final score = at(row, 4); + if (score < confidenceThreshold) { + continue; + } + final classIndex = at(row, 5).round(); + boxes.add( + YoloBox( + left: at(row, 0) * coordScale, + top: at(row, 1) * coordScale, + right: at(row, 2) * coordScale, + bottom: at(row, 3) * coordScale, + classIndex: classIndex, + score: score, + ), + ); + } + boxes.sort((a, b) => b.score.compareTo(a.score)); + if (boxes.length > maxDetections) { + return boxes.sublist(0, maxDetections); + } + return boxes; + } + + List _nms(List boxes, double iouThreshold) { + boxes.sort((a, b) => b.score.compareTo(a.score)); + final suppressed = List.filled(boxes.length, false); + final kept = []; + for (var i = 0; i < boxes.length; i++) { + if (suppressed[i]) { + continue; + } + kept.add(boxes[i]); + if (kept.length >= maxDetections) { + break; + } + for (var j = i + 1; j < boxes.length; j++) { + if (suppressed[j]) { + continue; + } + if (boxes[i].classIndex != boxes[j].classIndex) { + continue; + } + if (_iou(boxes[i], boxes[j]) > iouThreshold) { + suppressed[j] = true; + } + } + } + return kept; + } + + double _iou(YoloBox a, YoloBox b) { + final interLeft = math.max(a.left, b.left); + final interTop = math.max(a.top, b.top); + final interRight = math.min(a.right, b.right); + final interBottom = math.min(a.bottom, b.bottom); + final w = interRight - interLeft; + final h = interBottom - interTop; + if (w <= 0 || h <= 0) { + return 0; + } + final inter = w * h; + final union = a.width * a.height + b.width * b.height - inter; + if (union <= 0) { + return 0; + } + return inter / union; + } + + double _sigmoid(double value) { + if (value >= 0) { + final z = math.exp(-value); + return 1 / (1 + z); + } + final z = math.exp(value); + return z / (1 + z); + } +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..f09fb32 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,8 @@ +import 'package:flutter/widgets.dart'; + +import 'app/sign_checker_app.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + runApp(const SignCheckerApp()); +} diff --git a/lib/presentation/camera/camera_screen.dart b/lib/presentation/camera/camera_screen.dart new file mode 100644 index 0000000..76898ed --- /dev/null +++ b/lib/presentation/camera/camera_screen.dart @@ -0,0 +1,317 @@ +import 'package:camera/camera.dart'; +import 'package:flutter/cupertino.dart'; + +import '../../core/branding/app_brand.dart'; +import '../../theme/tokens.dart'; +import '../../ui/ui.dart'; +import '../catalog/catalog_page.dart'; +import '../theme/sign_style.dart'; +import 'recognition_controller.dart'; +import 'sign_panel.dart'; + +class CameraScreen extends StatefulWidget { + const CameraScreen({super.key, required this.controller}); + + final RecognitionController controller; + + @override + State createState() => _CameraScreenState(); +} + +class _CameraScreenState extends State + with WidgetsBindingObserver { + RecognitionController get controller => widget.controller; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + controller.addListener(_onChange); + controller.initialize(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + final camera = controller.cameraController; + if (camera == null || !camera.value.isInitialized) { + if (state == AppLifecycleState.resumed) { + controller.openCamera(); + } + return; + } + if (state == AppLifecycleState.inactive) { + controller.pause(); + } else if (state == AppLifecycleState.resumed) { + controller.openCamera(); + } + } + + void _onChange() { + if (mounted) { + setState(() {}); + } + } + + @override + void dispose() { + WidgetsBinding.instance.removeObserver(this); + controller.removeListener(_onChange); + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final camera = controller.cameraController; + return ColoredBox( + color: const Color(0xFF101114), + child: Stack( + fit: StackFit.expand, + children: [ + if (camera != null && camera.value.isInitialized) + _Preview(controller: controller) + else + _CameraPlaceholder(message: controller.cameraMessage), + const _TopBar(), + Align( + alignment: Alignment.bottomCenter, + child: _BottomSheet(controller: controller), + ), + ], + ), + ); + } +} + +class _Preview extends StatelessWidget { + const _Preview({required this.controller}); + + final RecognitionController controller; + + @override + Widget build(BuildContext context) { + final camera = controller.cameraController!; + final preview = camera.value.previewSize; + if (preview == null) { + return const SizedBox.shrink(); + } + final isPortrait = + MediaQuery.orientationOf(context) == Orientation.portrait; + return ClipRect( + child: FittedBox( + fit: BoxFit.cover, + child: SizedBox( + width: isPortrait ? preview.height : preview.width, + height: isPortrait ? preview.width : preview.height, + child: CameraPreview( + camera, + child: DetectionOverlay( + detections: controller.detections, + onSelect: (detection) => controller.pin(detection.rawLabel), + ), + ), + ), + ), + ); + } +} + +class _CameraPlaceholder extends StatelessWidget { + const _CameraPlaceholder({required this.message}); + + final String? message; + + @override + Widget build(BuildContext context) { + return ColoredBox( + color: const Color(0xFF101114), + child: Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Text( + message ?? 'Открываю камеру…', + textAlign: TextAlign.center, + style: const TextStyle(color: Color(0xFFFFFFFF), fontSize: 16), + ), + ), + ), + ); + } +} + +class _TopBar extends StatelessWidget { + const _TopBar(); + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.asset(AppBrand.iconAsset, width: 36, height: 36), + ), + const SizedBox(width: 10), + const Text( + AppBrand.name, + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 20, + fontWeight: FontWeight.w700, + ), + ), + const Spacer(), + CupertinoButton( + padding: const EdgeInsets.all(8), + onPressed: () { + Navigator.of(context).push( + CupertinoPageRoute( + builder: (_) => const CatalogPage(), + ), + ); + }, + child: const Icon( + CupertinoIcons.book, + color: Color(0xFFFFFFFF), + ), + ), + CupertinoButton( + padding: const EdgeInsets.all(8), + onPressed: () => _showHelp(context), + child: const Icon( + CupertinoIcons.slider_horizontal_3, + color: Color(0xFFFFFFFF), + ), + ), + ], + ), + ), + ); + } + + void _showHelp(BuildContext context) { + final controller = context + .findAncestorStateOfType<_CameraScreenState>()! + .controller; + showCupertinoModalPopup( + context: context, + builder: (context) { + return ListenableBuilder( + listenable: controller, + builder: (context, _) { + final background = AppColors.of( + context, + AppColors.groupedSurface, + ); + return Align( + alignment: Alignment.bottomCenter, + child: Container( + constraints: BoxConstraints( + maxHeight: MediaQuery.sizeOf(context).height * 0.75, + ), + decoration: BoxDecoration( + color: background, + borderRadius: const BorderRadius.vertical( + top: Radius.circular(AppRadii.xl), + ), + ), + child: SafeArea( + top: false, + child: ListView( + shrinkWrap: true, + padding: const EdgeInsets.fromLTRB(20, 16, 20, 24), + children: [ + const AppText.headline('Порог уверенности'), + const SizedBox(height: AppSpacing.s2), + AppText.callout( + '${(controller.confidenceThreshold * 100).round()}%. Ниже — больше срабатываний и больше ложных.', + ), + CupertinoSlider( + value: controller.confidenceThreshold, + min: 0.25, + max: 0.9, + onChanged: controller.setConfidenceThreshold, + ), + const SizedBox(height: AppSpacing.s3), + const AppText.headline('Модель'), + const SizedBox(height: AppSpacing.s2), + const AppText.body( + 'Распознавание идёт на телефоне, модель уже лежит в приложении.', + ), + const SizedBox(height: AppSpacing.s2), + const AppText.callout( + 'Модель собирается скриптом tools/train_signs_model.py на датасете российских знаков. Классы в assets/models/labels.txt идут в том же порядке, что classes.txt этого датасета. Варианты 3.24.1, 3.24.2 и дальше открывают один знак 3.24: цифра скорости на нём, а не номер класса.', + ), + const SizedBox(height: AppSpacing.s3), + const AppText.callout( + 'Жёлтый фон и знаки на переносных опорах временные. Если временный знак противоречит стационарному, водитель руководствуется временным.', + ), + const SizedBox(height: AppSpacing.s3), + const AppText.footnote(datasetAttribution), + ], + ), + ), + ), + ); + }, + ); + }, + ); + } +} + +class _BottomSheet extends StatelessWidget { + const _BottomSheet({required this.controller}); + + final RecognitionController controller; + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), + child: DecoratedBox( + decoration: BoxDecoration( + color: AppColors.of(context, AppColors.groupedSurface), + borderRadius: BorderRadius.circular(AppRadii.xl), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const AppText.footnote(safetyLine), + const SizedBox(height: AppSpacing.s3), + _body(), + if (controller.inferenceMs != null) ...[ + const SizedBox(height: AppSpacing.s1), + AppText.caption('Кадр ${controller.inferenceMs} мс'), + ], + ], + ), + ), + ), + ), + ); + } + + Widget _body() { + return switch (controller.modelStatus) { + ModelStatus.checking => const AppText.body('Проверяю модель…'), + ModelStatus.missing => const AppText.body( + 'Модель не установлена, поэтому знаки в кадре не называются. Справочник работает без неё. Как положить свою модель — кнопка настройки сверху.', + ), + ModelStatus.failed => AppText.body( + controller.modelMessage ?? 'Модель не запустилась.', + ), + ModelStatus.ready => SignPanel( + detections: controller.detections, + primary: controller.primary, + onSelect: (detection) => controller.pin(detection.rawLabel), + ), + }; + } +} diff --git a/lib/presentation/camera/recognition_controller.dart b/lib/presentation/camera/recognition_controller.dart new file mode 100644 index 0000000..688f123 --- /dev/null +++ b/lib/presentation/camera/recognition_controller.dart @@ -0,0 +1,317 @@ +import 'dart:async'; + +import 'package:camera/camera.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; + +import '../../data/catalog/bundled_sign_catalog.dart'; +import '../../data/detection/detector_worker.dart'; +import '../../data/frame/yuv_sampler.dart'; +import '../../domain/detection_stabilizer.dart'; +import '../../domain/rotation.dart'; +import '../../domain/sign_catalog.dart'; + +enum ModelStatus { checking, missing, ready, failed } + +class RecognitionController extends ChangeNotifier { + RecognitionController({SignCatalog? catalog, this._worker}) + : catalog = catalog ?? bundledSignCatalog; + + final SignCatalog catalog; + final DetectionStabilizer stabilizer = DetectionStabilizer(); + DetectorWorker? _worker; + + CameraController? cameraController; + List detections = const []; + String? pinnedLabel; + ModelStatus modelStatus = ModelStatus.checking; + String? modelMessage; + String? cameraMessage; + int? inferenceMs; + double confidenceThreshold = 0.45; + bool get modelReady => modelStatus == ModelStatus.ready; + + var _busy = false; + var _disposed = false; + var _cameraEpoch = 0; + var _reportedFormat = false; + + SignDetection? get primary { + if (detections.isEmpty) { + return null; + } + for (final detection in detections) { + if (detection.rawLabel == pinnedLabel) { + return detection; + } + } + return detections.first; + } + + Future initialize() async { + await Future.wait([openCamera(), _loadModel()]); + } + + Future openCamera() async { + if (_disposed) { + return; + } + final epoch = ++_cameraEpoch; + try { + final cameras = await availableCameras(); + if (_disposed || epoch != _cameraEpoch) { + return; + } + if (cameras.isEmpty) { + cameraMessage = 'На устройстве нет камеры.'; + notifyListeners(); + return; + } + final description = cameras.firstWhere( + (camera) => camera.lensDirection == CameraLensDirection.back, + orElse: () => cameras.first, + ); + final controller = CameraController( + description, + ResolutionPreset.medium, + enableAudio: false, + imageFormatGroup: ImageFormatGroup.yuv420, + ); + await controller.initialize(); + if (_disposed || epoch != _cameraEpoch) { + await controller.dispose(); + return; + } + cameraController = controller; + cameraMessage = null; + notifyListeners(); + await _startStream(); + } on CameraException catch (error) { + if (_disposed || epoch != _cameraEpoch) { + return; + } + cameraMessage = _cameraMessage(error); + notifyListeners(); + } + } + + Future pause() async { + _cameraEpoch++; + final controller = cameraController; + cameraController = null; + detections = const []; + stabilizer.reset(); + if (controller != null) { + if (controller.value.isInitialized && + controller.value.isStreamingImages) { + await controller.stopImageStream(); + } + await controller.dispose(); + } + if (!_disposed) { + notifyListeners(); + } + } + + void pin(String rawLabel) { + pinnedLabel = rawLabel; + notifyListeners(); + } + + void setConfidenceThreshold(double value) { + confidenceThreshold = value.clamp(0.25, 0.9); + stabilizer.reset(); + detections = const []; + notifyListeners(); + } + + Future _loadModel() async { + try { + final model = await rootBundle.load('assets/models/signs.tflite'); + final labelsFile = await rootBundle.loadString( + 'assets/models/labels.txt', + ); + final labels = [ + for (final line in labelsFile.split('\n')) + if (_labelLine(line) != null) _labelLine(line)!, + ]; + if (labels.isEmpty) { + modelStatus = ModelStatus.missing; + modelMessage = 'В labels.txt нет классов. Запишите номера знаков в том порядке, в каком училась модель.'; + notifyListeners(); + return; + } + final worker = _worker ?? DetectorWorker(); + _worker = worker; + await worker.start( + modelBytes: model.buffer.asUint8List(), + labels: labels, + ); + if (_disposed) { + await worker.dispose(); + return; + } + modelStatus = ModelStatus.ready; + modelMessage = null; + notifyListeners(); + await _startStream(); + } catch (error) { + if (_isMissingAsset(error)) { + modelStatus = ModelStatus.missing; + modelMessage = null; + } else { + modelStatus = ModelStatus.failed; + modelMessage = '$error'; + } + if (!_disposed) { + notifyListeners(); + } + } + } + + Future _startStream() async { + final controller = cameraController; + final worker = _worker; + if (controller == null || + worker == null || + !worker.isReady || + !controller.value.isInitialized || + controller.value.isStreamingImages) { + return; + } + await controller.startImageStream(_onFrame); + } + + void _onFrame(CameraImage image) { + if (_busy || _disposed) { + return; + } + final frame = _copyFrame(image); + if (frame == null) { + if (!_reportedFormat) { + _reportedFormat = true; + cameraMessage = 'Этот формат кадра камера не отдаёт как YUV420.'; + notifyListeners(); + } + return; + } + final controller = cameraController; + final worker = _worker; + if (controller == null || worker == null) { + return; + } + _busy = true; + final degrees = uprightClockwiseDegrees( + sensorOrientation: controller.description.sensorOrientation, + deviceDegrees: _deviceDegrees(controller.value.deviceOrientation), + frontCamera: + controller.description.lensDirection == CameraLensDirection.front, + ); + final mirror = + controller.description.lensDirection == CameraLensDirection.front; + worker + .detect( + frame: frame, + clockwiseDegrees: degrees, + confidenceThreshold: confidenceThreshold, + ) + .then((outcome) { + _busy = false; + if (_disposed) { + return; + } + inferenceMs = outcome.elapsedMs; + final hits = [ + for (final hit in outcome.hits) + SignDetection( + rawLabel: hit.label, + confidence: hit.confidence, + box: mirror ? hit.box.mirroredHorizontally() : hit.box, + sign: catalog.findByLabel(hit.label), + ), + ]; + detections = stabilizer.update(hits); + if (pinnedLabel != null && + detections.every((item) => item.rawLabel != pinnedLabel)) { + pinnedLabel = null; + } + notifyListeners(); + }) + .catchError((Object error) { + _busy = false; + if (_disposed) { + return; + } + modelStatus = ModelStatus.failed; + modelMessage = '$error'; + notifyListeners(); + final active = cameraController; + if (active != null && active.value.isStreamingImages) { + active.stopImageStream(); + } + }); + } + + YuvFrame? _copyFrame(CameraImage image) { + if (image.format.group != ImageFormatGroup.yuv420 || + image.planes.length < 3) { + return null; + } + final y = image.planes[0]; + final u = image.planes[1]; + final v = image.planes[2]; + return YuvFrame( + width: image.width, + height: image.height, + y: Uint8List.fromList(y.bytes), + u: Uint8List.fromList(u.bytes), + v: Uint8List.fromList(v.bytes), + yRowStride: y.bytesPerRow, + yPixelStride: y.bytesPerPixel ?? 1, + uvRowStride: u.bytesPerRow, + uvPixelStride: u.bytesPerPixel ?? 1, + ); + } + + @override + void dispose() { + _disposed = true; + final controller = cameraController; + cameraController = null; + if (controller != null) { + controller.dispose(); + } + unawaited(_worker?.dispose() ?? Future.value()); + super.dispose(); + } +} + +String? _labelLine(String line) { + final trimmed = line.trim(); + if (trimmed.isEmpty || trimmed.startsWith('#')) { + return null; + } + return trimmed; +} + +bool _isMissingAsset(Object error) { + final text = error.toString(); + return text.contains('Unable to load asset') || text.contains('signs.tflite'); +} + +int _deviceDegrees(DeviceOrientation orientation) { + return switch (orientation) { + DeviceOrientation.portraitUp => 0, + DeviceOrientation.landscapeLeft => 90, + DeviceOrientation.portraitDown => 180, + DeviceOrientation.landscapeRight => 270, + }; +} + +String _cameraMessage(CameraException error) { + return switch (error.code) { + 'CameraAccessDenied' || 'CameraAccessDeniedWithoutPrompt' => + 'Нет доступа к камере. Разрешите его в настройках Android.', + _ => error.description ?? 'Не удалось открыть камеру.', + }; +} diff --git a/lib/presentation/camera/sign_panel.dart b/lib/presentation/camera/sign_panel.dart new file mode 100644 index 0000000..1595ee3 --- /dev/null +++ b/lib/presentation/camera/sign_panel.dart @@ -0,0 +1,185 @@ +import 'package:flutter/cupertino.dart'; + +import '../../domain/detection_stabilizer.dart'; +import '../../theme/tokens.dart'; +import '../../ui/ui.dart'; +import '../catalog/sign_detail_page.dart'; +import '../catalog/sign_glyph.dart'; +import '../theme/sign_style.dart'; + +class SignPanel extends StatelessWidget { + const SignPanel({ + super.key, + required this.detections, + required this.primary, + required this.onSelect, + }); + + final List detections; + final SignDetection? primary; + final ValueChanged onSelect; + + @override + Widget build(BuildContext context) { + final current = primary; + if (current == null) { + return const AppText.callout( + 'Наведите камеру на знак. Рамка появится, когда знак удержится в кадре.', + ); + } + final sign = current.sign; + final color = categoryColor(sign?.category); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (detections.length > 1) + SizedBox( + height: 36, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: detections.length, + separatorBuilder: (_, _) => const SizedBox(width: 8), + itemBuilder: (context, index) { + final detection = detections[index]; + final selected = detection.rawLabel == current.rawLabel; + return CupertinoButton( + padding: const EdgeInsets.symmetric(horizontal: 12), + minimumSize: const Size(44, 32), + color: selected + ? AppColors.of(context, AppColors.accent) + : AppColors.of(context, AppColors.systemGray5), + borderRadius: BorderRadius.circular(AppRadii.capsule), + onPressed: () => onSelect(detection), + child: Text( + detection.titleCode, + style: TextStyle( + fontSize: 13, + color: selected + ? const Color(0xFFFFFFFF) + : AppColors.of(context, AppColors.label), + ), + ), + ); + }, + ), + ), + if (detections.length > 1) const SizedBox(height: AppSpacing.s2), + Row( + children: [ + AppText.title(current.titleCode, color: color), + const SizedBox(width: AppSpacing.s3), + AppText.callout('${(current.confidence * 100).round()}%'), + ], + ), + const SizedBox(height: AppSpacing.s2), + if (sign == null) + AppText.body( + 'Модель назвала «${current.rawLabel}». Такого номера нет в справочнике, поэтому правило не показываю.', + ) + else ...[ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SignGlyph(sign: sign, size: 64), + const SizedBox(width: AppSpacing.s3), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText.headline(sign.name), + const SizedBox(height: AppSpacing.s2), + AppText.callout(sign.action), + ], + ), + ), + ], + ), + if (sign.requiresReadingTheSign) ...[ + const SizedBox(height: AppSpacing.s2), + const AppText.footnote( + faceReadingWarning, + color: AppColors.systemOrange, + ), + ], + Align( + alignment: Alignment.centerLeft, + child: CupertinoButton( + padding: const EdgeInsets.only(top: AppSpacing.s2), + onPressed: () { + Navigator.of(context).push( + CupertinoPageRoute( + builder: (_) => SignDetailPage(sign: sign), + ), + ); + }, + child: const Text('Подробнее'), + ), + ), + ], + ], + ); + } +} + +class DetectionOverlay extends StatelessWidget { + const DetectionOverlay({ + super.key, + required this.detections, + required this.onSelect, + }); + + final List detections; + final ValueChanged onSelect; + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth; + final height = constraints.maxHeight; + return Stack( + children: [ + for (final detection in detections) + Positioned( + left: detection.box.left * width, + top: detection.box.top * height, + width: detection.box.width * width, + height: detection.box.height * height, + child: GestureDetector( + onTap: () => onSelect(detection), + child: DecoratedBox( + decoration: BoxDecoration( + border: Border.all( + color: categoryColor(detection.sign?.category), + width: 3, + ), + borderRadius: BorderRadius.circular(8), + ), + child: Align( + alignment: Alignment.topLeft, + child: ColoredBox( + color: categoryColor(detection.sign?.category), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 6, + vertical: 2, + ), + child: Text( + detection.titleCode, + style: const TextStyle( + color: Color(0xFF000000), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ), + ), + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/presentation/catalog/catalog_page.dart b/lib/presentation/catalog/catalog_page.dart new file mode 100644 index 0000000..4b6a990 --- /dev/null +++ b/lib/presentation/catalog/catalog_page.dart @@ -0,0 +1,127 @@ +import 'package:flutter/cupertino.dart'; + +import '../../data/catalog/bundled_sign_catalog.dart'; +import '../../domain/sign_catalog.dart'; +import '../../domain/traffic_sign.dart'; +import '../../theme/tokens.dart'; +import '../../ui/ui.dart'; +import '../theme/sign_style.dart'; +import 'sign_detail_page.dart'; +import 'sign_glyph.dart'; + +class CatalogPage extends StatefulWidget { + const CatalogPage({super.key, this.catalog}); + + final SignCatalog? catalog; + + @override + State createState() => _CatalogPageState(); +} + +class _CatalogPageState extends State { + final _query = TextEditingController(); + + @override + void dispose() { + _query.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final catalog = widget.catalog ?? bundledSignCatalog; + final query = _query.text.trim().toLowerCase(); + final signs = catalog.signs.where((sign) { + if (query.isEmpty) { + return true; + } + return sign.code.toLowerCase().contains(query) || + sign.name.toLowerCase().contains(query); + }).toList(); + + return CupertinoPageScaffold( + backgroundColor: AppColors.of(context, AppColors.groupedBackground), + navigationBar: const CupertinoNavigationBar(middle: Text('Справочник')), + child: SafeArea( + child: ListView( + padding: const EdgeInsets.only(bottom: AppSpacing.s6), + children: [ + Padding( + padding: const EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s3, + AppSpacing.gutter, + AppSpacing.s2, + ), + child: AppTextField( + controller: _query, + onChanged: (_) => setState(() {}), + placeholder: 'Номер или название, например 3.27', + prefixIcon: CupertinoIcons.search, + ), + ), + if (signs.isEmpty) + const Padding( + padding: EdgeInsets.all(AppSpacing.s5), + child: AppText.footnote( + 'Ничего не найдено', + textAlign: TextAlign.center, + ), + ) + else + for (final category in SignCategory.values) + _CategorySection( + category: category, + signs: signs + .where((sign) => sign.category == category) + .toList(), + ), + const Padding( + padding: EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s4, + AppSpacing.gutter, + 0, + ), + child: AppText.footnote(signImageAttribution), + ), + ], + ), + ), + ); + } +} + +class _CategorySection extends StatelessWidget { + const _CategorySection({required this.category, required this.signs}); + + final SignCategory category; + final List signs; + + @override + Widget build(BuildContext context) { + if (signs.isEmpty) { + return const SizedBox.shrink(); + } + return AppListSection( + header: categoryTitle(category), + separatorIndent: 76, + children: [ + for (final sign in signs) + AppListTile( + leading: SignGlyph(sign: sign, size: 44), + title: sign.name, + subtitle: sign.action, + value: sign.code, + onTap: () { + Navigator.of(context).push( + CupertinoPageRoute( + builder: (_) => SignDetailPage(sign: sign), + ), + ); + }, + ), + ], + ); + } +} diff --git a/lib/presentation/catalog/sign_detail_page.dart b/lib/presentation/catalog/sign_detail_page.dart new file mode 100644 index 0000000..72ca946 --- /dev/null +++ b/lib/presentation/catalog/sign_detail_page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/cupertino.dart'; + +import '../../domain/traffic_sign.dart'; +import '../../theme/tokens.dart'; +import '../../ui/ui.dart'; +import '../theme/sign_style.dart'; +import 'sign_glyph.dart'; + +class SignDetailPage extends StatelessWidget { + const SignDetailPage({super.key, required this.sign}); + + final TrafficSign sign; + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + backgroundColor: AppColors.of(context, AppColors.groupedBackground), + navigationBar: CupertinoNavigationBar(middle: Text(sign.code)), + child: SafeArea( + child: ListView( + padding: const EdgeInsets.only(bottom: AppSpacing.s7), + children: [ + const SizedBox(height: AppSpacing.s4), + Center(child: SignGlyph(sign: sign, size: 140)), + const SizedBox(height: AppSpacing.s3), + AppText.title(sign.name, textAlign: TextAlign.center), + const SizedBox(height: AppSpacing.s1), + AppText.footnote( + categoryTitle(sign.category), + textAlign: TextAlign.center, + color: categoryColor(sign.category), + ), + AppListSection( + header: 'Что означает', + children: [ + Padding( + padding: const EdgeInsets.all(AppSpacing.gutter), + child: AppText.body(sign.summary), + ), + ], + ), + AppListSection( + header: 'Что делать', + children: [ + Padding( + padding: const EdgeInsets.all(AppSpacing.gutter), + child: AppText.body(sign.action), + ), + ], + ), + if (sign.requiresReadingTheSign) + const Padding( + padding: EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s4, + AppSpacing.gutter, + 0, + ), + child: AppText.footnote( + faceReadingWarning, + color: AppColors.systemOrange, + ), + ), + const Padding( + padding: EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s4, + AppSpacing.gutter, + 0, + ), + child: AppText.footnote(safetyLine), + ), + const Padding( + padding: EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s3, + AppSpacing.gutter, + 0, + ), + child: AppText.caption(signImageAttribution), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/catalog/sign_glyph.dart b/lib/presentation/catalog/sign_glyph.dart new file mode 100644 index 0000000..86c5efb --- /dev/null +++ b/lib/presentation/catalog/sign_glyph.dart @@ -0,0 +1,81 @@ +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import '../../data/catalog/sign_image_assets.dart'; +import '../../domain/traffic_sign.dart'; +import '../theme/sign_style.dart'; + +class SignGlyph extends StatelessWidget { + const SignGlyph({super.key, required this.sign, this.size = 48}); + + final TrafficSign sign; + final double size; + + static Future? _assetPackage; + + /// The app stores diagrams at `assets/signs/`. Widgetbook is a separate + /// package, so the same files are exposed as `packages/sign_checker/...`. + static Future _resolveAssetPackage() async { + final manifest = await AssetManifest.loadFromAssetBundle(rootBundle); + final names = manifest.listAssets(); + if (names.contains('assets/signs/1.1.svg')) { + return null; + } + if (names.contains('packages/sign_checker/assets/signs/1.1.svg')) { + return 'sign_checker'; + } + return null; + } + + @override + Widget build(BuildContext context) { + if (!signImageAssets.contains(sign.code)) { + return _frame(image: false, child: _codeLabel()); + } + _assetPackage ??= _resolveAssetPackage(); + return FutureBuilder( + future: _assetPackage, + builder: (context, snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return _frame(image: true, child: const SizedBox.shrink()); + } + return _frame( + image: true, + child: SvgPicture.asset( + 'assets/signs/${sign.code}.svg', + package: snapshot.data, + width: size, + height: size, + fit: BoxFit.contain, + ), + ); + }, + ); + } + + Widget _codeLabel() { + return Text( + sign.code, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color(0xFF000000), + fontWeight: FontWeight.w700, + fontSize: 11, + ), + ); + } + + Widget _frame({required bool image, required Widget child}) { + return Container( + width: size + 8, + height: size + 8, + alignment: Alignment.center, + decoration: BoxDecoration( + color: image ? const Color(0xFFFFFFFF) : categoryColor(sign.category), + borderRadius: BorderRadius.circular(8), + ), + child: child, + ); + } +} diff --git a/lib/presentation/theme/sign_style.dart b/lib/presentation/theme/sign_style.dart new file mode 100644 index 0000000..69ac6cb --- /dev/null +++ b/lib/presentation/theme/sign_style.dart @@ -0,0 +1,47 @@ +import 'package:flutter/painting.dart'; + +import '../../domain/traffic_sign.dart'; + +const String faceReadingWarning = + 'Часть требования написана или нарисована на самом знаке. Приложение определяет тип, цифру и схему смотрите на знаке.'; + +const String safetyLine = + 'Подсказка, не замена ПДД. Решение за водителем, сверяйтесь со знаком.'; + +String categoryTitle(SignCategory category) { + return switch (category) { + SignCategory.warning => 'Предупреждающие', + SignCategory.priority => 'Приоритет', + SignCategory.prohibitory => 'Запрещающие', + SignCategory.mandatory => 'Предписывающие', + SignCategory.special => 'Особые предписания', + SignCategory.information => 'Информационные', + SignCategory.service => 'Сервис', + SignCategory.plate => 'Таблички', + SignCategory.signal => 'Светофоры', + }; +} + +Color categoryColor(SignCategory? category) { + return switch (category) { + SignCategory.warning => const Color(0xFFE6A23C), + SignCategory.priority => const Color(0xFFF2C200), + SignCategory.prohibitory => const Color(0xFFE23B3B), + SignCategory.mandatory => const Color(0xFF3D7EFF), + SignCategory.special => const Color(0xFF2F9E6B), + SignCategory.information => const Color(0xFF2AA39A), + SignCategory.service => const Color(0xFF6EA8FF), + SignCategory.plate => const Color(0xFFB7C0CC), + SignCategory.signal => const Color(0xFFF5D90A), + null => const Color(0xFFECEFF4), + }; +} + +const String signImageAttribution = + 'Схемы знаков взяты со страницы drom.ru/pdd/pdd/signs/ и повторяют ГОСТ Р 52290-2004. ' + 'Пояснения с той страницы в приложение не копировались.'; + +const String datasetAttribution = + 'Детектор учится на датасете Dognellaf/russian-road-signs (CC BY 4.0). ' + 'Автор датасета указан по условиям лицензии: ' + 'https://huggingface.co/datasets/Dognellaf/russian-road-signs'; diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart new file mode 100644 index 0000000..5acc52b --- /dev/null +++ b/lib/theme/app_theme.dart @@ -0,0 +1,57 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:sign_checker/theme/tokens.dart'; + +TextStyle _sf(TextStyle style, {Color? color}) { + return GoogleFonts.inter(textStyle: style, color: color); +} + +CupertinoTextThemeData _textTheme() { + return CupertinoTextThemeData( + primaryColor: AppColors.accent, + textStyle: _sf(AppTypography.body, color: AppColors.label), + actionTextStyle: _sf(AppTypography.body, color: AppColors.accent), + tabLabelTextStyle: _sf( + AppTypography.caption2, + color: AppColors.secondaryLabel, + ), + navTitleTextStyle: _sf(AppTypography.headline, color: AppColors.label), + navLargeTitleTextStyle: _sf( + AppTypography.largeTitle, + color: AppColors.label, + ), + navActionTextStyle: _sf(AppTypography.body, color: AppColors.accent), + ); +} + +CupertinoThemeData buildLightTheme() => _buildTheme(Brightness.light); + +CupertinoThemeData buildDarkTheme() => _buildTheme(Brightness.dark); + +CupertinoThemeData _buildTheme(Brightness brightness) { + return CupertinoThemeData( + brightness: brightness, + primaryColor: AppColors.accent, + primaryContrastingColor: const Color(0xFFFFFFFF), + scaffoldBackgroundColor: AppColors.groupedBackground, + barBackgroundColor: AppColors.barBackground, + applyThemeToAll: true, + textTheme: _textTheme(), + ); +} + +SystemUiOverlayStyle systemUiOverlayFor(Brightness brightness) { + final dark = brightness == Brightness.dark; + return SystemUiOverlayStyle( + statusBarColor: const Color(0x00000000), + statusBarBrightness: brightness, + statusBarIconBrightness: dark ? Brightness.light : Brightness.dark, + systemNavigationBarColor: dark + ? const Color(0x00000000) + : const Color(0x00FFFFFF), + systemNavigationBarDividerColor: const Color(0x00000000), + systemNavigationBarIconBrightness: dark ? Brightness.light : Brightness.dark, + systemNavigationBarContrastEnforced: false, + ); +} diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart new file mode 100644 index 0000000..691937b --- /dev/null +++ b/lib/theme/theme.dart @@ -0,0 +1,2 @@ +export 'app_theme.dart'; +export 'tokens.dart'; diff --git a/lib/theme/tokens.dart b/lib/theme/tokens.dart new file mode 100644 index 0000000..6e86eec --- /dev/null +++ b/lib/theme/tokens.dart @@ -0,0 +1,181 @@ +/// Design tokens copied from the Please Pay Me iOS kit. +/// +/// Spacing, type scale and grouped surfaces stay the same. The accent is blue +/// so Sign Detector does not inherit that product's green brand. +library; + +import 'package:flutter/cupertino.dart'; + +abstract final class AppColors { + static const accent = CupertinoDynamicColor.withBrightness( + color: Color(0xFF0A64D8), + darkColor: Color(0xFF4C9DFF), + ); + + static const accentSoft = CupertinoDynamicColor.withBrightness( + color: Color(0xFFE6F0FC), + darkColor: Color(0xFF142033), + ); + + static const systemRed = CupertinoDynamicColor.withBrightness( + color: Color(0xFFFF3B30), + darkColor: Color(0xFFFF453A), + ); + static const systemOrange = CupertinoDynamicColor.withBrightness( + color: Color(0xFFFF9500), + darkColor: Color(0xFFFF9F0A), + ); + static const systemGreen = CupertinoDynamicColor.withBrightness( + color: Color(0xFF34C759), + darkColor: Color(0xFF30D158), + ); + static const systemGray = CupertinoDynamicColor.withBrightness( + color: Color(0xFF8E8E93), + darkColor: Color(0xFF8E8E93), + ); + static const systemGray3 = CupertinoDynamicColor.withBrightness( + color: Color(0xFFC7C7CC), + darkColor: Color(0xFF48484A), + ); + static const systemGray5 = CupertinoDynamicColor.withBrightness( + color: Color(0xFFE5E5EA), + darkColor: Color(0xFF2C2C2E), + ); + static const systemGray6 = CupertinoDynamicColor.withBrightness( + color: Color(0xFFF2F2F7), + darkColor: Color(0xFF1C1C1E), + ); + + static const label = CupertinoDynamicColor.withBrightness( + color: Color(0xFF000000), + darkColor: Color(0xFFFFFFFF), + ); + static const secondaryLabel = CupertinoDynamicColor.withBrightness( + color: Color(0x993C3C43), + darkColor: Color(0x99EBEBF5), + ); + static const tertiaryLabel = CupertinoDynamicColor.withBrightness( + color: Color(0x4D3C3C43), + darkColor: Color(0x4DEBEBF5), + ); + + static const separator = CupertinoDynamicColor.withBrightness( + color: Color(0x4A3C3C43), + darkColor: Color(0xA6545458), + ); + static const opaqueSeparator = CupertinoDynamicColor.withBrightness( + color: Color(0xFFC6C6C8), + darkColor: Color(0xFF38383A), + ); + static const groupedBackground = CupertinoDynamicColor.withBrightness( + color: Color(0xFFF2F2F7), + darkColor: Color(0xFF000000), + ); + static const groupedSurface = CupertinoDynamicColor.withBrightness( + color: Color(0xFFFFFFFF), + darkColor: Color(0xFF1C1C1E), + ); + static const barBackground = CupertinoDynamicColor.withBrightness( + color: Color(0xF0F9F9F9), + darkColor: Color(0xF01D1D1D), + ); + + static Color of(BuildContext context, Color color) => + CupertinoDynamicColor.resolve(color, context); +} + +abstract final class AppSpacing { + static const double s1 = 4; + static const double s2 = 8; + static const double s3 = 12; + static const double s4 = 16; + static const double s5 = 20; + static const double s6 = 28; + static const double s7 = 40; + static const double s8 = 56; + static const double gutter = 16; +} + +abstract final class AppRadii { + static const double sm = 6; + static const double md = 10; + static const double lg = 12; + static const double xl = 16; + static const double capsule = 999; +} + +abstract final class AppSizes { + static const double buttonLarge = 50; + static const double buttonMedium = 44; + static const double buttonSmall = 34; + static const double rowMinHeight = 44; + static const double hairline = 0.5; +} + +abstract final class AppTypography { + static const largeTitle = TextStyle( + fontSize: 34, + height: 1.2, + fontWeight: FontWeight.w700, + letterSpacing: 0.37, + ); + static const title1 = TextStyle( + fontSize: 28, + height: 1.2, + fontWeight: FontWeight.w700, + letterSpacing: 0.36, + ); + static const title2 = TextStyle( + fontSize: 22, + height: 1.25, + fontWeight: FontWeight.w700, + letterSpacing: 0.35, + ); + static const title3 = TextStyle( + fontSize: 20, + height: 1.25, + fontWeight: FontWeight.w600, + letterSpacing: 0.38, + ); + static const headline = TextStyle( + fontSize: 17, + height: 1.3, + fontWeight: FontWeight.w600, + letterSpacing: -0.41, + ); + static const body = TextStyle( + fontSize: 17, + height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: -0.41, + ); + static const callout = TextStyle( + fontSize: 16, + height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: -0.32, + ); + static const subhead = TextStyle( + fontSize: 15, + height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: -0.24, + ); + static const footnote = TextStyle( + fontSize: 13, + height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: -0.08, + ); + static const caption1 = TextStyle( + fontSize: 12, + height: 1.3, + fontWeight: FontWeight.w400, + ); + static const caption2 = TextStyle( + fontSize: 11, + height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: 0.07, + ); +} diff --git a/lib/ui/atoms/app_button.dart b/lib/ui/atoms/app_button.dart new file mode 100644 index 0000000..77d1aa3 --- /dev/null +++ b/lib/ui/atoms/app_button.dart @@ -0,0 +1,114 @@ +import 'package:flutter/cupertino.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:sign_checker/theme/tokens.dart'; + +enum AppButtonStyle { filled, tinted, gray, plain, destructive } + +enum AppButtonSize { large, medium, small } + +class AppButton extends StatelessWidget { + const AppButton({ + super.key, + required this.label, + this.onPressed, + this.style = AppButtonStyle.filled, + this.size = AppButtonSize.large, + this.expanded = true, + this.icon, + this.loading = false, + }); + + final String label; + final VoidCallback? onPressed; + final AppButtonStyle style; + final AppButtonSize size; + final bool expanded; + final IconData? icon; + final bool loading; + + double get _height => switch (size) { + AppButtonSize.large => AppSizes.buttonLarge, + AppButtonSize.medium => AppSizes.buttonMedium, + AppButtonSize.small => AppSizes.buttonSmall, + }; + + TextStyle get _textStyle => switch (size) { + AppButtonSize.large => AppTypography.headline, + AppButtonSize.medium => AppTypography.body, + AppButtonSize.small => AppTypography.subhead.copyWith( + fontWeight: FontWeight.w600, + ), + }; + + @override + Widget build(BuildContext context) { + final accent = AppColors.of(context, AppColors.accent); + final red = AppColors.of(context, AppColors.systemRed); + + final (Color background, Color foreground) = switch (style) { + AppButtonStyle.filled => (accent, const Color(0xFFFFFFFF)), + AppButtonStyle.tinted => (accent.withValues(alpha: 0.15), accent), + AppButtonStyle.gray => ( + AppColors.of(context, AppColors.systemGray5), + AppColors.of(context, AppColors.label), + ), + AppButtonStyle.plain => (const Color(0x00000000), accent), + AppButtonStyle.destructive => (red.withValues(alpha: 0.15), red), + }; + + final disabled = onPressed == null || loading; + final content = loading + ? CupertinoActivityIndicator( + radius: size == AppButtonSize.small ? 8 : 10, + color: foreground, + ) + : Row( + mainAxisSize: expanded ? MainAxisSize.max : MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (icon != null) ...[ + Icon( + icon, + size: size == AppButtonSize.small ? 16 : 19, + color: foreground, + ), + const SizedBox(width: AppSpacing.s2), + ], + Flexible( + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: GoogleFonts.inter( + textStyle: _textStyle, + color: foreground, + ), + ), + ), + ], + ); + + return Opacity( + opacity: disabled && !loading ? 0.35 : 1, + child: SizedBox( + height: _height, + width: expanded ? double.infinity : null, + child: CupertinoButton( + onPressed: disabled ? null : onPressed, + color: style == AppButtonStyle.plain ? null : background, + disabledColor: background, + borderRadius: BorderRadius.circular( + size == AppButtonSize.small ? AppRadii.md : AppRadii.lg, + ), + padding: EdgeInsets.symmetric( + horizontal: size == AppButtonSize.small + ? AppSpacing.s3 + : AppSpacing.s4, + ), + minimumSize: Size.zero, + child: content, + ), + ), + ); + } +} diff --git a/lib/ui/atoms/app_text.dart b/lib/ui/atoms/app_text.dart new file mode 100644 index 0000000..9b822de --- /dev/null +++ b/lib/ui/atoms/app_text.dart @@ -0,0 +1,137 @@ +import 'package:flutter/cupertino.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:sign_checker/theme/tokens.dart'; + +class AppText extends StatelessWidget { + const AppText( + this.data, { + super.key, + this.style = AppTypography.body, + this.color = AppColors.label, + this.maxLines, + this.overflow, + this.textAlign, + }); + + const AppText.largeTitle( + this.data, { + super.key, + this.color = AppColors.label, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.largeTitle; + + const AppText.title( + this.data, { + super.key, + this.color = AppColors.label, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.title2; + + const AppText.headline( + this.data, { + super.key, + this.color = AppColors.label, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.headline; + + const AppText.body( + this.data, { + super.key, + this.color = AppColors.label, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.body; + + const AppText.callout( + this.data, { + super.key, + this.color = AppColors.secondaryLabel, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.callout; + + const AppText.subhead( + this.data, { + super.key, + this.color = AppColors.secondaryLabel, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.subhead; + + const AppText.footnote( + this.data, { + super.key, + this.color = AppColors.secondaryLabel, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.footnote; + + const AppText.caption( + this.data, { + super.key, + this.color = AppColors.tertiaryLabel, + this.maxLines, + this.overflow, + this.textAlign, + }) : style = AppTypography.caption1; + + final String data; + final TextStyle style; + final Color color; + final int? maxLines; + final TextOverflow? overflow; + final TextAlign? textAlign; + + @override + Widget build(BuildContext context) { + return Text( + data, + maxLines: maxLines, + overflow: overflow, + textAlign: textAlign, + style: GoogleFonts.inter( + textStyle: style, + color: AppColors.of(context, color), + ), + ); + } +} + +class AppSectionHeader extends StatelessWidget { + const AppSectionHeader(this.text, {super.key, this.padding}); + + final String text; + final EdgeInsetsGeometry? padding; + + @override + Widget build(BuildContext context) { + return Padding( + padding: + padding ?? + const EdgeInsets.fromLTRB( + AppSpacing.gutter, + AppSpacing.s4, + AppSpacing.gutter, + AppSpacing.s2, + ), + child: Text( + text.toUpperCase(), + style: GoogleFonts.inter( + textStyle: AppTypography.footnote, + color: AppColors.of(context, AppColors.secondaryLabel), + letterSpacing: 0.4, + ), + ), + ); + } +} diff --git a/lib/ui/atoms/app_text_field.dart b/lib/ui/atoms/app_text_field.dart new file mode 100644 index 0000000..e073486 --- /dev/null +++ b/lib/ui/atoms/app_text_field.dart @@ -0,0 +1,104 @@ +import 'package:flutter/cupertino.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:sign_checker/theme/tokens.dart'; +import 'package:sign_checker/ui/atoms/app_text.dart'; + +class AppTextField extends StatelessWidget { + const AppTextField({ + super.key, + this.label, + this.placeholder, + this.controller, + this.onChanged, + this.keyboardType, + this.obscureText = false, + this.enabled = true, + this.errorText, + this.prefixIcon, + this.clearable = true, + this.maxLines = 1, + }); + + final String? label; + final String? placeholder; + final TextEditingController? controller; + final ValueChanged? onChanged; + final TextInputType? keyboardType; + final bool obscureText; + final bool enabled; + final String? errorText; + final IconData? prefixIcon; + final bool clearable; + final int maxLines; + + @override + Widget build(BuildContext context) { + final hasError = errorText != null && errorText!.isNotEmpty; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (label != null) + AppSectionHeader( + label!, + padding: const EdgeInsets.only(bottom: AppSpacing.s2), + ), + Opacity( + opacity: enabled ? 1 : 0.4, + child: CupertinoTextField( + controller: controller, + onChanged: onChanged, + keyboardType: keyboardType, + obscureText: obscureText, + enabled: enabled, + maxLines: maxLines, + placeholder: placeholder, + clearButtonMode: clearable + ? OverlayVisibilityMode.editing + : OverlayVisibilityMode.never, + padding: const EdgeInsets.symmetric( + horizontal: AppSpacing.s3, + vertical: AppSpacing.s3, + ), + prefix: prefixIcon == null + ? null + : Padding( + padding: const EdgeInsets.only(left: AppSpacing.s3), + child: Icon( + prefixIcon, + size: 20, + color: AppColors.of(context, AppColors.secondaryLabel), + ), + ), + placeholderStyle: GoogleFonts.inter( + textStyle: AppTypography.body, + color: AppColors.of(context, AppColors.tertiaryLabel), + ), + style: GoogleFonts.inter( + textStyle: AppTypography.body, + color: AppColors.of(context, AppColors.label), + ), + decoration: BoxDecoration( + color: AppColors.of(context, AppColors.groupedSurface), + borderRadius: BorderRadius.circular(AppRadii.md), + border: Border.all( + color: hasError + ? AppColors.of(context, AppColors.systemRed) + : AppColors.of(context, AppColors.opaqueSeparator), + width: AppSizes.hairline, + ), + ), + ), + ), + if (hasError) + Padding( + padding: const EdgeInsets.only( + top: AppSpacing.s2, + left: AppSpacing.s1, + ), + child: AppText.footnote(errorText!, color: AppColors.systemRed), + ), + ], + ); + } +} diff --git a/lib/ui/molecules/app_list_section.dart b/lib/ui/molecules/app_list_section.dart new file mode 100644 index 0000000..da3662a --- /dev/null +++ b/lib/ui/molecules/app_list_section.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker/theme/tokens.dart'; +import 'package:sign_checker/ui/atoms/app_text.dart'; + +class AppListSection extends StatelessWidget { + const AppListSection({ + super.key, + required this.children, + this.header, + this.footer, + this.separatorIndent = 16, + this.margin = const EdgeInsets.symmetric(horizontal: AppSpacing.gutter), + }); + + final List children; + final String? header; + final String? footer; + final double separatorIndent; + final EdgeInsetsGeometry margin; + + @override + Widget build(BuildContext context) { + final rows = []; + for (var i = 0; i < children.length; i++) { + rows.add(children[i]); + if (i < children.length - 1) { + rows.add( + Padding( + padding: EdgeInsets.only(left: separatorIndent), + child: Container( + height: AppSizes.hairline, + color: AppColors.of(context, AppColors.opaqueSeparator), + ), + ), + ); + } + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (header != null) AppSectionHeader(header!), + Container( + margin: margin, + decoration: BoxDecoration( + color: AppColors.of(context, AppColors.groupedSurface), + borderRadius: BorderRadius.circular(AppRadii.lg), + ), + clipBehavior: Clip.antiAlias, + child: Column(children: rows), + ), + if (footer != null) + Padding( + padding: const EdgeInsets.fromLTRB( + AppSpacing.gutter + 4, + AppSpacing.s2, + AppSpacing.gutter + 4, + 0, + ), + child: AppText.footnote(footer!), + ), + ], + ); + } +} diff --git a/lib/ui/molecules/app_list_tile.dart b/lib/ui/molecules/app_list_tile.dart new file mode 100644 index 0000000..70028be --- /dev/null +++ b/lib/ui/molecules/app_list_tile.dart @@ -0,0 +1,113 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker/theme/tokens.dart'; +import 'package:sign_checker/ui/atoms/app_text.dart'; + +class AppListTile extends StatefulWidget { + const AppListTile({ + super.key, + required this.title, + this.subtitle, + this.leading, + this.value, + this.trailing, + this.onTap, + this.showChevron = true, + this.destructive = false, + }); + + final String title; + final String? subtitle; + final Widget? leading; + final String? value; + final Widget? trailing; + final VoidCallback? onTap; + final bool showChevron; + final bool destructive; + + @override + State createState() => _AppListTileState(); +} + +class _AppListTileState extends State { + bool _pressed = false; + + @override + Widget build(BuildContext context) { + final tappable = widget.onTap != null; + + final row = Container( + color: _pressed + ? AppColors.of(context, AppColors.systemGray5) + : AppColors.of(context, AppColors.groupedSurface), + constraints: const BoxConstraints(minHeight: AppSizes.rowMinHeight), + padding: const EdgeInsets.symmetric( + horizontal: AppSpacing.gutter, + vertical: AppSpacing.s2 + 2, + ), + child: Row( + children: [ + if (widget.leading != null) ...[ + widget.leading!, + const SizedBox(width: AppSpacing.s3), + ], + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText.body( + widget.title, + color: widget.destructive + ? AppColors.systemRed + : AppColors.label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + if (widget.subtitle != null) ...[ + const SizedBox(height: 2), + AppText.footnote( + widget.subtitle!, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ], + ), + ), + if (widget.trailing != null) + widget.trailing! + else ...[ + if (widget.value != null) + Padding( + padding: const EdgeInsets.only(left: AppSpacing.s2), + child: AppText.body( + widget.value!, + color: AppColors.secondaryLabel, + ), + ), + if (tappable && widget.showChevron) + Padding( + padding: const EdgeInsets.only(left: AppSpacing.s1), + child: Icon( + CupertinoIcons.chevron_forward, + size: 16, + color: AppColors.of(context, AppColors.tertiaryLabel), + ), + ), + ], + ], + ), + ); + + if (!tappable) return row; + + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: widget.onTap, + onTapDown: (_) => setState(() => _pressed = true), + onTapUp: (_) => setState(() => _pressed = false), + onTapCancel: () => setState(() => _pressed = false), + child: row, + ); + } +} diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart new file mode 100644 index 0000000..f86fdfe --- /dev/null +++ b/lib/ui/ui.dart @@ -0,0 +1,5 @@ +export 'atoms/app_button.dart'; +export 'atoms/app_text.dart'; +export 'atoms/app_text_field.dart'; +export 'molecules/app_list_section.dart'; +export 'molecules/app_list_tile.dart'; diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..4c9a990 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,634 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: "6c5bcd986e06b94e3c40244af471750840a3d2341d1f9763a1100a14add517b4" + url: "https://pub.dev" + source: hosted + version: "4.3.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + camera: + dependency: "direct main" + description: + name: camera + sha256: "3f30ca0ff376f91534f23afa2a7aea06ebb6c889fd9e260642437b37e3d9f753" + url: "https://pub.dev" + source: hosted + version: "0.12.1" + camera_android_camerax: + dependency: transitive + description: + name: camera_android_camerax + sha256: a9d527411429f97976dc1f97b0dbe57560c9d3ae482e2f45b7d0a2a61c6bf8f9 + url: "https://pub.dev" + source: hosted + version: "0.7.5" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: e409a731fad3fca10daa9567cf981720398659e6390f871a4e0f576058ff8940 + url: "https://pub.dev" + source: hosted + version: "0.10.3+1" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: "9365babc7488a9e93d0ed6dcccd917619fb12ea6f9e601519e1191d4890ee2fe" + url: "https://pub.dev" + source: hosted + version: "2.14.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: "5aecf1ac4dd4a949c5a7820e590020acb2bc35425384ab87a030e1739bfe12e2" + url: "https://pub.dev" + source: hosted + version: "0.3.5+6" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6 + url: "https://pub.dev" + source: hosted + version: "0.3.5+5" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" + url: "https://pub.dev" + source: hosted + version: "0.14.4" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "3854fe5e3bff0b113c658f260b90c95dea17c92db0f2addeac2e343dd9969785" + url: "https://pub.dev" + source: hosted + version: "2.0.35" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "35882981abcbfb8c15b286f0cd690ff25bac12d95eff3e25ee207f37d4c42e7f" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: ba03d03bcaa2f6cb7bd920e3b5027181db75ab524f8891c8bc3aa603885b8055 + url: "https://pub.dev" + source: hosted + version: "6.3.3" + hooks: + dependency: transitive + description: + name: hooks + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: a1e7f4951e538a568e14b856702afc9ae1d2f4b202daced8d22c1b9cd211ce89 + url: "https://pub.dev" + source: hosted + version: "4.10.1" + jni: + dependency: transitive + description: + name: jni + sha256: f038e58b4dc2c9037f50e233175086337e0b305e356d28211bf55f21c504cbd3 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: b2310cdd4c18c65c081ab141a41efa94aa26c65431803703ece51996f174f351 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + jni_util: + dependency: transitive + description: + name: jni_util + sha256: "1ba86da04a5f2bf18fde2edb235587e70c5b0fc5bd4ba955f46b00942c3fc35f" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: c82594181e3312f3d0695fc95aaaf7758d75b8d4ae2bbecf223b9fd5109a059d + url: "https://pub.dev" + source: hosted + version: "1.18.3" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: b7fb95a6d9a4f009edd63dc5ac69f07420b23a16161c6dd8660290b59c602e8e + url: "https://pub.dev" + source: hosted + version: "9.5.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec + url: "https://pub.dev" + source: hosted + version: "3.2.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: bc1bad54ad2b735816e31f8d4600cfde6c7839975085ddfbca48b6c9f7c4044e + url: "https://pub.dev" + source: hosted + version: "6.5.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + quiver: + dependency: transitive + description: + name: quiver + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11" + url: "https://pub.dev" + source: hosted + version: "0.7.12" + tflite_flutter: + dependency: "direct main" + description: + name: tflite_flutter + sha256: "0bba9040d8decda0960d7abf8eabf32243bf092bc7d0084e8e19681866b0bdbe" + url: "https://pub.dev" + source: hosted + version: "0.12.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "9d0e3b9cb16542ad660daee871e726a10d13a93b7b5391677c3160e8f5e83935" + url: "https://pub.dev" + source: hosted + version: "1.2.3" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + url: "https://pub.dev" + source: hosted + version: "1.1.13" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "4dca4feb77dc3ec7f6e27e49c53241eb8217f55e4f9b12599a27f8903bca5682" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "1d774bbdf6b72a0b12122fc1560c9c2d2a67db5a4a4cc2bd8a5c990ab20e3188" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5f37239c4851efcef929cea7824e76df7f2f0970aef85d66bbc430afa40e72f0" + url: "https://pub.dev" + source: hosted + version: "15.3.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.4 <4.0.0" + flutter: ">=3.44.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..cd33959 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,105 @@ +name: sign_checker +description: "Распознавание дорожных знаков РФ с камеры и справочник ПДД." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.13.4 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + camera: ^0.12.1 + flutter_svg: ^2.2.3 + google_fonts: ^6.3.2 + tflite_flutter: ^0.12.1 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + flutter_launcher_icons: ^0.14.4 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + uses-material-design: true + + assets: + - assets/models/ + - assets/signs/ + - assets/branding/app_icon.png + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package + +flutter_launcher_icons: + android: true + ios: false + image_path: assets/branding/app_icon.png + adaptive_icon_background: "#10141A" + adaptive_icon_foreground: assets/branding/app_icon.png + adaptive_icon_foreground_inset: 0 + min_sdk_android: 24 diff --git a/test/catalog_page_test.dart b/test/catalog_page_test.dart new file mode 100644 index 0000000..558bb38 --- /dev/null +++ b/test/catalog_page_test.dart @@ -0,0 +1,37 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:sign_checker/data/catalog/bundled_sign_catalog.dart'; +import 'package:sign_checker/presentation/catalog/catalog_page.dart'; +import 'package:sign_checker/presentation/catalog/sign_detail_page.dart'; + +void main() { + setUpAll(() { + GoogleFonts.config.allowRuntimeFetching = false; + }); + + testWidgets('catalog opens the sign and shows the driver action', ( + tester, + ) async { + await tester.pumpWidget(const CupertinoApp(home: CatalogPage())); + await tester.enterText(find.byType(CupertinoTextField), '3.27'); + await tester.pump(); + + expect(find.text('Остановка запрещена'), findsOneWidget); + await tester.tap(find.text('Остановка запрещена')); + await tester.pumpAndSettle(); + + expect(find.text('ЧТО ДЕЛАТЬ'), findsOneWidget); + expect(find.textContaining('Не останавливайтесь'), findsOneWidget); + }); + + testWidgets('detail page warns when the sign face carries the number', ( + tester, + ) async { + final sign = bundledSignCatalog.findByCode('3.24')!; + await tester.pumpWidget( + CupertinoApp(home: SignDetailPage(sign: sign)), + ); + expect(find.textContaining('цифру и схему'), findsOneWidget); + }); +} diff --git a/test/detection_stabilizer_test.dart b/test/detection_stabilizer_test.dart new file mode 100644 index 0000000..266cfa4 --- /dev/null +++ b/test/detection_stabilizer_test.dart @@ -0,0 +1,24 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:sign_checker/domain/detection_stabilizer.dart'; +import 'package:sign_checker/domain/norm_rect.dart'; + +void main() { + SignDetection hit(String label) { + return SignDetection( + rawLabel: label, + confidence: 0.9, + box: const NormRect(0.1, 0.1, 0.2, 0.2), + ); + } + + test('a sign is shown only after a second hit and dropped after misses', () { + final stabilizer = DetectionStabilizer(); + expect(stabilizer.update([hit('3.27')]), isEmpty); + final visible = stabilizer.update([hit('3.27')]); + expect(visible, hasLength(1)); + expect(visible.single.rawLabel, '3.27'); + + expect(stabilizer.update(const []), hasLength(1)); + expect(stabilizer.update(const []), isEmpty); + }); +} diff --git a/test/geometry_test.dart b/test/geometry_test.dart new file mode 100644 index 0000000..8709e43 --- /dev/null +++ b/test/geometry_test.dart @@ -0,0 +1,38 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:sign_checker/domain/letterbox.dart'; +import 'package:sign_checker/domain/rotation.dart'; + +void main() { + test('letterbox centers a wide frame in the square', () { + final box = Letterbox.fit(srcWidth: 200, srcHeight: 100, inputSize: 100); + expect(box.scale, 0.5); + expect(box.padX, 0); + expect(box.padY, 25); + final source = box.uprightFromModel(50, 25); + expect(source.$1, 100); + expect(source.$2, 0); + }); + + test('portrait compensation rotates the back-camera buffer', () { + expect( + uprightClockwiseDegrees( + sensorOrientation: 90, + deviceDegrees: 0, + frontCamera: false, + ), + 90, + ); + final raw = rawPixelFromUpright( + ux: 1, + uy: 0, + rawWidth: 4, + rawHeight: 2, + clockwiseDegrees: 90, + ); + expect(raw, (0, 0)); + expect(uprightSize(rawWidth: 4, rawHeight: 2, clockwiseDegrees: 90), ( + 2, + 4, + )); + }); +} diff --git a/test/sign_catalog_test.dart b/test/sign_catalog_test.dart new file mode 100644 index 0000000..379b54a --- /dev/null +++ b/test/sign_catalog_test.dart @@ -0,0 +1,54 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:sign_checker/data/catalog/bundled_sign_catalog.dart'; +import 'package:sign_checker/domain/sign_code.dart'; + +void main() { + test('labels with a sign number resolve, free text does not', () { + final catalog = bundledSignCatalog; + expect(catalog.findByLabel('3_27')?.name, 'Остановка запрещена'); + expect(catalog.findByLabel('sign-2.5')?.code, '2.5'); + expect(catalog.findByLabel('speed_limit'), isNull); + expect(catalog.findByLabel('3.13.35'), isNull); + expect(catalog.findByLabel('2.3'), isNull); + expect(normalizeSignCode('8.13'), '8.13'); + }); + + test('dataset speed variants and traffic lights resolve without guessing', () { + final catalog = bundledSignCatalog; + expect(catalog.findByLabel('3.24.7')?.code, '3.24'); + expect(catalog.findByLabel('3.24')?.code, '3.24'); + expect(catalog.findByLabel('redTrafficLights')?.code, 'signal.red'); + expect(catalog.findByLabel('TrafficLights')?.name, 'Светофор'); + expect( + catalog.findByLabel('redyellowTrafficLights')?.action, + contains('зелёный'), + ); + }); + + test('critical signs keep the distinctions drivers mix up', () { + final catalog = bundledSignCatalog; + final stop = catalog.findByCode('3.27')!; + expect(stop.summary, contains('остановка')); + expect(stop.summary, contains('стоянка')); + + final parking = catalog.findByCode('3.28')!; + expect(parking.summary, contains('не запрещена')); + + final halt = catalog.findByCode('2.5')!; + expect(halt.action, contains('Остановитесь')); + + final yieldSign = catalog.findByCode('2.4')!; + expect(yieldSign.action, contains('уступите')); + + final speed = catalog.findByCode('3.24')!; + expect(speed.requiresReadingTheSign, isTrue); + expect(speed.action, contains('цифру')); + }); + + test('every code is unique and sortable', () { + final codes = bundledSignCatalog.signs.map((sign) => sign.code).toList(); + expect(codes.toSet(), hasLength(codes.length)); + expect(codes.first, '1.1'); + expect(codes.indexOf('1.4.2'), lessThan(codes.indexOf('1.20.1'))); + }); +} diff --git a/test/yolo_decoder_test.dart b/test/yolo_decoder_test.dart new file mode 100644 index 0000000..c51638f --- /dev/null +++ b/test/yolo_decoder_test.dart @@ -0,0 +1,86 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:sign_checker/domain/yolo_decoder.dart'; + +void main() { + const decoder = YoloDecoder(); + + test('raw head keeps the stronger box and suppresses the overlap', () { + const channels = 6; + const anchors = 8; + final data = Float32List(channels * anchors); + void set(int channel, int anchor, double value) { + data[channel * anchors + anchor] = value; + } + + set(0, 3, 100); + set(1, 3, 80); + set(2, 3, 40); + set(3, 3, 20); + set(4, 3, 0.05); + set(5, 3, 0.91); + + set(0, 4, 104); + set(1, 4, 82); + set(2, 4, 40); + set(3, 4, 20); + set(4, 4, 0.02); + set(5, 4, 0.62); + + final boxes = decoder.decode( + data: data, + shape: const [1, channels, anchors], + inputSize: 320, + confidenceThreshold: 0.4, + iouThreshold: 0.45, + ); + + expect(boxes, hasLength(1)); + expect(boxes.single.classIndex, 1); + expect(boxes.single.score, closeTo(0.91, 1e-6)); + expect(boxes.single.left, closeTo(80, 1e-6)); + expect(boxes.single.top, closeTo(70, 1e-6)); + expect(boxes.single.right, closeTo(120, 1e-6)); + expect(boxes.single.bottom, closeTo(90, 1e-6)); + }); + + test('nms head reads xyxy, score and class', () { + final data = Float32List.fromList([ + 10, 12, 40, 50, 0.8, 3, // + 0, 0, 0, 0, 0.1, 0, + ]); + final boxes = decoder.decode( + data: data, + shape: const [1, 2, 6], + inputSize: 320, + confidenceThreshold: 0.4, + iouThreshold: 0.45, + ); + expect(boxes, hasLength(1)); + expect(boxes.single.classIndex, 3); + expect(boxes.single.left, 10); + expect(boxes.single.bottom, 50); + }); + + test('normalized coordinates are scaled into the input square', () { + const channels = 6; + const anchors = 8; + final data = Float32List(channels * anchors); + data[0 * anchors + 1] = 0.5; + data[1 * anchors + 1] = 0.5; + data[2 * anchors + 1] = 0.25; + data[3 * anchors + 1] = 0.25; + data[5 * anchors + 1] = 0.95; + + final boxes = decoder.decode( + data: data, + shape: const [1, channels, anchors], + inputSize: 320, + confidenceThreshold: 0.4, + iouThreshold: 0.45, + ); + expect(boxes.single.left, closeTo(120, 1e-6)); + expect(boxes.single.width, closeTo(80, 1e-6)); + }); +} diff --git a/test/yuv_sampler_test.dart b/test/yuv_sampler_test.dart new file mode 100644 index 0000000..4ccdcdd --- /dev/null +++ b/test/yuv_sampler_test.dart @@ -0,0 +1,30 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:sign_checker/data/frame/yuv_sampler.dart'; + +void main() { + test('neutral chroma and full luma become white, padding stays gray', () { + final frame = YuvFrame( + width: 2, + height: 1, + y: Uint8List.fromList([255, 255]), + u: Uint8List.fromList([128]), + v: Uint8List.fromList([128]), + yRowStride: 2, + yPixelStride: 1, + uvRowStride: 1, + uvPixelStride: 1, + ); + final tensor = YuvSampler().sample( + frame: frame, + clockwiseDegrees: 0, + inputSize: 4, + ); + expect(tensor[0], closeTo(114 / 255, 0.02)); + final mid = (1 * 4 + 1) * 3; + expect(tensor[mid], greaterThan(0.9)); + expect(tensor[mid + 1], greaterThan(0.9)); + expect(tensor[mid + 2], greaterThan(0.9)); + }); +} diff --git a/tools/export_signs_model.py b/tools/export_signs_model.py new file mode 100644 index 0000000..c2a57a0 --- /dev/null +++ b/tools/export_signs_model.py @@ -0,0 +1,44 @@ +"""Export an Ultralytics YOLO detect model for this Flutter app. + +Class names must be traffic-sign numbers from the Russian traffic rules, +for example 3.27 or 1.23. Their order becomes assets/models/labels.txt. + +The app reads float32 NHWC input [1, N, N, 3]. Do not export half or int8. + + python tools/export_signs_model.py best.pt --imgsz 320 + +If the installed Ultralytics build no longer accepts format=tflite, the +script retries format=litert. Both write a .tflite file. +""" + +from __future__ import annotations + +import argparse +from pathlib import Path + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("weights", type=Path) + parser.add_argument("--imgsz", type=int, default=320) + args = parser.parse_args() + + from ultralytics import YOLO + + model = YOLO(str(args.weights)) + try: + exported = model.export(format="tflite", imgsz=args.imgsz) + except Exception: + exported = model.export(format="litert", imgsz=args.imgsz) + + names = model.names + ordered = [str(names[index]) for index in range(len(names))] + labels_path = Path("assets/models/labels.txt") + labels_path.write_text("\n".join(ordered) + "\n", encoding="utf-8") + print(f"Exported: {exported}") + print(f"Wrote {labels_path} ({len(ordered)} classes)") + print("Copy the .tflite file to assets/models/signs.tflite and rebuild.") + + +if __name__ == "__main__": + main() diff --git a/tools/fetch_drom_sign_svgs.py b/tools/fetch_drom_sign_svgs.py new file mode 100644 index 0000000..70d3155 --- /dev/null +++ b/tools/fetch_drom_sign_svgs.py @@ -0,0 +1,153 @@ +"""Download GOST sign diagrams from the drom.ru PDD page into assets/signs. + +The page text is not copied. Only the SVG drawings are saved, and only for +sign numbers that exist in the app catalog. + + python tools/fetch_drom_sign_svgs.py +""" + +from __future__ import annotations + +import re +import urllib.request +from concurrent.futures import ThreadPoolExecutor +from html.parser import HTMLParser +from pathlib import Path + +PAGE_URL = "https://www.drom.ru/pdd/pdd/signs/" +CATALOG = Path("lib/data/catalog/sign_definitions.dart") +ASSET_DIR = Path("assets/signs") +INDEX = Path("lib/data/catalog/sign_image_assets.dart") +CODE = re.compile(r"\d+\.\d+(?:\.\d+)*") +CATALOG_CODE = re.compile(r"_s\(\s*'([^']+)'") + + +class _SignPage(HTMLParser): + def __init__(self) -> None: + super().__init__(convert_charrefs=True) + self.depth = 0 + self.capture_title = False + self.title: list[str] = [] + self.images: list[str] = [] + self.found: list[tuple[list[str], str]] = [] + + def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None: + attributes = {key: value or "" for key, value in attrs} + classes = set(attributes.get("class", "").split()) + if tag == "div": + if self.depth == 0 and "pub" in classes: + self.depth = 1 + self.images = [] + self.title = [] + self.capture_title = False + elif self.depth: + self.depth += 1 + if self.depth and tag == "img": + src = attributes.get("src", "") + if src.endswith(".svg"): + self.images.append(src) + if self.depth and tag == "h4": + self.capture_title = True + self.title = [] + + def handle_endtag(self, tag: str) -> None: + if tag == "h4": + self.capture_title = False + if tag == "div" and self.depth: + self.depth -= 1 + if self.depth == 0 and self.images: + self.found.append((self.images, "".join(self.title))) + + def handle_data(self, data: str) -> None: + if self.capture_title: + self.title.append(data) + + +def catalog_codes() -> list[str]: + text = CATALOG.read_text(encoding="utf-8") + return CATALOG_CODE.findall(text) + + +def sign_urls(html: str) -> dict[str, str]: + parser = _SignPage() + parser.feed(html) + chosen: dict[str, str] = {} + for images, title in parser.found: + codes = CODE.findall(title) + if not images or not codes: + continue + if len(images) == len(codes): + pairs = zip(codes, images) + else: + pairs = ((code, images[0]) for code in codes) + for code, src in pairs: + chosen.setdefault(code, src) + return chosen + + +def download(url: str, destination: Path) -> None: + request = urllib.request.Request(url, headers={"User-Agent": "sign-checker"}) + with urllib.request.urlopen(request, timeout=60) as response: + payload = response.read() + if not payload.lstrip().startswith(b" None: + lines = [ + "// Generated by tools/fetch_drom_sign_svgs.py.", + "const Set signImageAssets = {", + ] + lines.extend(f" '{code}'," for code in codes) + lines.append("};") + lines.append("") + INDEX.write_text("\n".join(lines), encoding="utf-8") + + +def main() -> None: + request = urllib.request.Request(PAGE_URL, headers={"User-Agent": "sign-checker"}) + with urllib.request.urlopen(request, timeout=60) as response: + html = response.read().decode("cp1251") + urls = sign_urls(html) + wanted = [code for code in catalog_codes() if not code.startswith("signal.")] + for code in list(wanted): + if code in urls: + continue + parent = max( + (name for name in urls if code.startswith(name + ".")), + key=len, + default="", + ) + if parent: + urls[code] = urls[parent] + ASSET_DIR.mkdir(parents=True, exist_ok=True) + + saved: list[str] = [] + missing: list[str] = [] + jobs: list[tuple[str, str, Path]] = [] + for code in wanted: + url = urls.get(code) + if url is None: + missing.append(code) + continue + jobs.append((code, url, ASSET_DIR / f"{code}.svg")) + + def fetch(job: tuple[str, str, Path]) -> str: + code, url, destination = job + if destination.is_file() and destination.stat().st_size > 100: + return code + download(url, destination) + return code + + with ThreadPoolExecutor(max_workers=8) as pool: + saved = list(pool.map(fetch, jobs)) + + write_index(saved) + print(f"saved={len(saved)} missing={len(missing)}") + if missing: + print("missing: " + ", ".join(missing)) + + +if __name__ == "__main__": + main() diff --git a/tools/prepare_hf_dataset.py b/tools/prepare_hf_dataset.py new file mode 100644 index 0000000..7543fbb --- /dev/null +++ b/tools/prepare_hf_dataset.py @@ -0,0 +1,169 @@ +"""Download Dognellaf/russian-road-signs and split it by video clip. + +Frames from one clip stay in the same split. A random image split would put +neighboring frames into both train and val and inflate the metric. + +Unlabeled videos are not downloaded. Images are not copied: train.txt and +val.txt point at the files already on disk. + + python tools/prepare_hf_dataset.py + python tools/prepare_hf_dataset.py --split-only +""" + +from __future__ import annotations + +import argparse +import hashlib +import re +from pathlib import Path + +REPO_ID = "Dognellaf/russian-road-signs" +VAL_PERCENT = 15 + +_FRAME = re.compile(r"__frame-.*$", re.IGNORECASE) +_OUTPUT = re.compile(r"-output$", re.IGNORECASE) +_TAIL_INDEX = re.compile(r"__\d+_?$") + + +def clip_id(filename: str) -> str: + stem = Path(filename).stem + stem = _FRAME.sub("", stem) + stem = _OUTPUT.sub("", stem) + stem = _TAIL_INDEX.sub("", stem) + stem = stem.strip("_-") + return stem or Path(filename).stem + + +def _label_path(image: Path, root: Path) -> Path: + relative = image.relative_to(root) + return root / "labels" / relative.relative_to("images").with_suffix(".txt") + + +def collect_images(root: Path) -> list[Path]: + images_root = root / "images" + chosen: dict[str, Path] = {} + for image in images_root.rglob("*.jpg"): + label = _label_path(image, root) + if not label.is_file(): + continue + current = chosen.get(image.name) + if current is None or len(image.parts) < len(current.parts): + chosen[image.name] = image + return sorted(chosen.values()) + + +def write_splits(root: Path, val_percent: int = VAL_PERCENT) -> tuple[int, int]: + images = collect_images(root) + if not images: + raise SystemExit(f"No labeled images under {root / 'images'}") + + clips: dict[str, list[Path]] = {} + for image in images: + clips.setdefault(clip_id(image.name), []).append(image) + + train: list[Path] = [] + val: list[Path] = [] + for clip, frames in clips.items(): + bucket = int(hashlib.sha256(clip.encode("utf-8")).hexdigest(), 16) % 100 + target = val if bucket < val_percent else train + target.extend(frames) + + split_dir = root / "splits" + split_dir.mkdir(parents=True, exist_ok=True) + _write_list(split_dir / "train.txt", root, train) + _write_list(split_dir / "val.txt", root, val) + _write_data_yaml(root) + _copy_labels(root) + print( + f"clips={len(clips)} train_images={len(train)} val_images={len(val)} " + f"root={root}" + ) + return len(train), len(val) + + +def _write_list(path: Path, root: Path, images: list[Path]) -> None: + # Absolute paths. Ultralytics reads each line as-is and only turns a + # leading "./" into a path next to the txt file. A relative "images/..." + # line is then resolved from the process cwd, so the matching label is + # never found on Windows. + root = root.resolve() + lines = [] + for image in images: + resolved = image.resolve() + resolved.relative_to(root) + lines.append(resolved.as_posix()) + path.write_text("\n".join(lines) + ("\n" if lines else ""), encoding="utf-8") + + +def _class_names(root: Path) -> list[str]: + classes = root / "classes.txt" + names = [line.strip() for line in classes.read_text(encoding="utf-8").splitlines()] + names = [name for name in names if name] + if not names: + raise SystemExit(f"{classes} is empty") + return names + + +def _write_data_yaml(root: Path) -> None: + names = _class_names(root) + lines = [ + f"path: {root.as_posix()}", + "train: splits/train.txt", + "val: splits/val.txt", + "names:", + ] + lines.extend( + f' {index}: "{name}"' for index, name in enumerate(names) + ) + (root / "data.yaml").write_text("\n".join(lines) + "\n", encoding="utf-8") + + +def _copy_labels(root: Path) -> None: + destination = Path("assets/models/labels.txt") + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_text("\n".join(_class_names(root)) + "\n", encoding="utf-8") + + +def download(root: Path) -> None: + from huggingface_hub import snapshot_download + + snapshot_download( + repo_id=REPO_ID, + repo_type="dataset", + local_dir=str(root), + max_workers=32, + allow_patterns=[ + "images/**", + "labels/**", + "classes.txt", + "LICENSE", + "README.md", + ], + ignore_patterns=["unlabeled/**"], + ) + + +def _self_test() -> None: + assert clip_id("00030002__2_-output__frame-0-00-27.67.jpg") == "00030002" + assert clip_id("00030002__15_-output__frame-0-01-10.67.jpg") == "00030002" + assert clip_id("0_inter-n-13__inter-n-13__10_.jpg") == "0_inter-n-13__inter-n-13" + assert clip_id("0_inter-n-13__inter-n-13__2_.jpg") == "0_inter-n-13__inter-n-13" + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("--root", type=Path, default=Path("data/russian-road-signs")) + parser.add_argument("--split-only", action="store_true") + parser.add_argument("--self-test", action="store_true") + args = parser.parse_args() + if args.self_test: + _self_test() + print("clip id checks passed") + return + if not args.split_only: + download(args.root) + write_splits(args.root) + + +if __name__ == "__main__": + main() diff --git a/tools/train_signs_model.py b/tools/train_signs_model.py new file mode 100644 index 0000000..27d896a --- /dev/null +++ b/tools/train_signs_model.py @@ -0,0 +1,106 @@ +"""Train a float32 YOLO detector on the prepared Russian sign dataset. + +Expects tools/prepare_hf_dataset.py to have written data/russian-road-signs/data.yaml. +Exports signs.tflite into assets/models and rewrites labels.txt from the +trained class order. + + python tools/train_signs_model.py +""" + +from __future__ import annotations + +import argparse +import shutil +from pathlib import Path + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--data", + type=Path, + default=Path("data/russian-road-signs/data.yaml"), + ) + parser.add_argument("--model", default="yolo11n.pt") + parser.add_argument("--imgsz", type=int, default=320) + parser.add_argument("--epochs", type=int, default=40) + parser.add_argument("--batch", type=int, default=32) + parser.add_argument("--device", default="0") + parser.add_argument( + "--weights", + type=Path, + default=None, + help="Skip training and export this checkpoint to float32 TFLite.", + ) + args = parser.parse_args() + if args.weights is None and not args.data.is_file(): + raise SystemExit(f"Missing {args.data}. Run tools/prepare_hf_dataset.py first.") + + from ultralytics import YOLO + + if args.weights is None: + model = YOLO(args.model) + result = model.train( + data=str(args.data), + imgsz=args.imgsz, + epochs=args.epochs, + batch=args.batch, + device=args.device, + workers=4, + patience=8, + project="runs/signs", + name="yolo11n-russian-signs", + exist_ok=True, + ) + weights = Path(result.save_dir) / "weights" / "best.pt" + else: + weights = args.weights + if not weights.is_file(): + raise SystemExit(f"Missing weights: {weights}") + + trained = YOLO(str(weights)) + # LiteRT export is Linux/macOS only. On Windows the SavedModel path + # still writes a float32 .tflite via onnx2tf. + exported = Path( + trained.export(format="saved_model", imgsz=args.imgsz, half=False, int8=False) + ) + + tflite = _find_tflite(exported) + destination = Path("assets/models/signs.tflite") + destination.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(tflite, destination) + + names = trained.names + ordered = [str(names[index]) for index in range(len(names))] + Path("assets/models/labels.txt").write_text( + "\n".join(ordered) + "\n", + encoding="utf-8", + ) + print(f"Copied {tflite} -> {destination}") + + +def _find_tflite(exported: Path) -> Path: + candidates: list[Path] = [] + if exported.suffix == ".tflite" and exported.is_file(): + candidates.append(exported) + search_root = exported if exported.is_dir() else exported.parent + candidates.extend(search_root.rglob("*.tflite")) + float32 = [ + path + for path in candidates + if "float32" in path.name and "float16" not in path.name and "int8" not in path.name + ] + if float32: + return float32[0] + plain = [ + path + for path in candidates + if "float16" not in path.name and "int8" not in path.name and "quant" not in path.name + ] + if plain: + return plain[0] + raise SystemExit(f"Export finished but no float32 .tflite file was found near {exported}") + + +if __name__ == "__main__": + main() diff --git a/weights/yolo26n.pt b/weights/yolo26n.pt new file mode 100644 index 0000000..be48188 Binary files /dev/null and b/weights/yolo26n.pt differ diff --git a/widgetbook/analysis_options.yaml b/widgetbook/analysis_options.yaml new file mode 100644 index 0000000..5e2133e --- /dev/null +++ b/widgetbook/analysis_options.yaml @@ -0,0 +1 @@ +include: ../analysis_options.yaml diff --git a/widgetbook/lib/addons/device_frame_addon.dart b/widgetbook/lib/addons/device_frame_addon.dart new file mode 100644 index 0000000..b8b007a --- /dev/null +++ b/widgetbook/lib/addons/device_frame_addon.dart @@ -0,0 +1,9 @@ +import 'package:widgetbook/widgetbook.dart'; + +ViewportAddon buildDeviceFrameAddon() { + return ViewportAddon([ + Viewports.none, + IosViewports.iPhone13, + AndroidViewports.samsungGalaxyS20, + ]); +} diff --git a/widgetbook/lib/addons/locale_addon.dart b/widgetbook/lib/addons/locale_addon.dart new file mode 100644 index 0000000..8796bb3 --- /dev/null +++ b/widgetbook/lib/addons/locale_addon.dart @@ -0,0 +1,15 @@ +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:widgetbook/widgetbook.dart'; + +LocalizationAddon buildLocaleAddon() { + return LocalizationAddon( + locales: const [Locale('ru'), Locale('en')], + localizationsDelegates: const [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + initialLocale: const Locale('ru'), + ); +} diff --git a/widgetbook/lib/addons/theme_addon.dart b/widgetbook/lib/addons/theme_addon.dart new file mode 100644 index 0000000..cc4e642 --- /dev/null +++ b/widgetbook/lib/addons/theme_addon.dart @@ -0,0 +1,11 @@ +import 'package:sign_checker/theme/theme.dart'; +import 'package:widgetbook/widgetbook.dart'; + +CupertinoThemeAddon buildThemeAddon() { + return CupertinoThemeAddon( + themes: [ + WidgetbookTheme(name: 'Light', data: buildLightTheme()), + WidgetbookTheme(name: 'Dark', data: buildDarkTheme()), + ], + ); +} diff --git a/widgetbook/lib/app.dart b/widgetbook/lib/app.dart new file mode 100644 index 0000000..ab251ff --- /dev/null +++ b/widgetbook/lib/app.dart @@ -0,0 +1,24 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker_widgetbook/addons/device_frame_addon.dart'; +import 'package:sign_checker_widgetbook/addons/locale_addon.dart'; +import 'package:sign_checker_widgetbook/addons/theme_addon.dart'; +import 'package:sign_checker_widgetbook/catalog.dart'; +import 'package:widgetbook/widgetbook.dart'; + +class WidgetbookRoot extends StatelessWidget { + const WidgetbookRoot({super.key}); + + @override + Widget build(BuildContext context) { + return Widgetbook.cupertino( + directories: buildCatalogDirectories(), + addons: [ + buildThemeAddon(), + buildLocaleAddon(), + buildDeviceFrameAddon(), + InspectorAddon(), + AlignmentAddon(initialAlignment: Alignment.center), + ], + ); + } +} diff --git a/widgetbook/lib/catalog.dart b/widgetbook/lib/catalog.dart new file mode 100644 index 0000000..681c0f4 --- /dev/null +++ b/widgetbook/lib/catalog.dart @@ -0,0 +1,31 @@ +import 'package:sign_checker_widgetbook/use_cases/atoms/buttons_use_cases.dart'; +import 'package:sign_checker_widgetbook/use_cases/atoms/text_fields_use_cases.dart'; +import 'package:sign_checker_widgetbook/use_cases/atoms/typography_use_cases.dart'; +import 'package:sign_checker_widgetbook/use_cases/molecules/list_tiles_use_cases.dart'; +import 'package:sign_checker_widgetbook/use_cases/screens/sign_screens_use_cases.dart'; +import 'package:widgetbook/widgetbook.dart'; + +List buildCatalogDirectories() { + return [ + WidgetbookFolder( + name: 'Atoms', + children: [ + buttonsComponent(), + textFieldsComponent(), + typographyComponent(), + ], + ), + WidgetbookFolder( + name: 'Molecules', + children: [listTilesComponent()], + ), + WidgetbookFolder( + name: 'Screens', + children: [ + catalogScreenComponent(), + signDetailScreenComponent(), + signPanelComponent(), + ], + ), + ]; +} diff --git a/widgetbook/lib/knobs/common_knobs.dart b/widgetbook/lib/knobs/common_knobs.dart new file mode 100644 index 0000000..5496144 --- /dev/null +++ b/widgetbook/lib/knobs/common_knobs.dart @@ -0,0 +1,32 @@ +import 'package:flutter/widgets.dart'; +import 'package:widgetbook/widgetbook.dart'; + +String knobText( + BuildContext context, { + required String label, + String initialValue = 'Label', +}) { + return context.knobs.string(label: label, initialValue: initialValue); +} + +bool knobBool( + BuildContext context, { + required String label, + bool initialValue = false, +}) { + return context.knobs.boolean(label: label, initialValue: initialValue); +} + +T knobEnum( + BuildContext context, { + required String label, + required List values, + required T initial, +}) { + return context.knobs.object.dropdown( + label: label, + options: values, + labelBuilder: (value) => value.name, + initialOption: initial, + ); +} diff --git a/widgetbook/lib/main.dart b/widgetbook/lib/main.dart new file mode 100644 index 0000000..e9443eb --- /dev/null +++ b/widgetbook/lib/main.dart @@ -0,0 +1,7 @@ +import 'package:flutter/widgets.dart'; +import 'package:sign_checker_widgetbook/app.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + runApp(const WidgetbookRoot()); +} diff --git a/widgetbook/lib/support/preview.dart b/widgetbook/lib/support/preview.dart new file mode 100644 index 0000000..d42be78 --- /dev/null +++ b/widgetbook/lib/support/preview.dart @@ -0,0 +1,53 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker/theme/theme.dart'; + +class IosPreview extends StatelessWidget { + const IosPreview({ + super.key, + required this.child, + this.padding = const EdgeInsets.symmetric(vertical: AppSpacing.s5), + this.maxWidth = 420, + this.stretch = false, + }); + + const IosPreview.centered({super.key, required this.child}) + : padding = const EdgeInsets.all(AppSpacing.s5), + maxWidth = 420, + stretch = false; + + final Widget child; + final EdgeInsetsGeometry padding; + final double maxWidth; + final bool stretch; + + @override + Widget build(BuildContext context) { + return ColoredBox( + color: AppColors.of(context, AppColors.groupedBackground), + child: Center( + child: SingleChildScrollView( + padding: padding, + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: maxWidth), + child: Column( + crossAxisAlignment: stretch + ? CrossAxisAlignment.stretch + : CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [child], + ), + ), + ), + ), + ); + } +} + +class IosScreenPreview extends StatelessWidget { + const IosScreenPreview({super.key, required this.child}); + + final Widget child; + + @override + Widget build(BuildContext context) => child; +} diff --git a/widgetbook/lib/use_cases/atoms/buttons_use_cases.dart b/widgetbook/lib/use_cases/atoms/buttons_use_cases.dart new file mode 100644 index 0000000..041f76a --- /dev/null +++ b/widgetbook/lib/use_cases/atoms/buttons_use_cases.dart @@ -0,0 +1,70 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker/theme/theme.dart'; +import 'package:sign_checker/ui/ui.dart'; +import 'package:sign_checker_widgetbook/knobs/common_knobs.dart'; +import 'package:sign_checker_widgetbook/support/preview.dart'; +import 'package:widgetbook/widgetbook.dart'; + +WidgetbookComponent buttonsComponent() { + return WidgetbookComponent( + name: 'AppButton', + useCases: [ + WidgetbookUseCase( + name: 'Playground', + builder: (context) { + return IosPreview( + stretch: true, + child: AppButton( + label: knobText( + context, + label: 'Label', + initialValue: 'Подробнее', + ), + style: knobEnum( + context, + label: 'Style', + values: AppButtonStyle.values, + initial: AppButtonStyle.filled, + ), + size: knobEnum( + context, + label: 'Size', + values: AppButtonSize.values, + initial: AppButtonSize.large, + ), + expanded: knobBool( + context, + label: 'Expanded', + initialValue: true, + ), + loading: knobBool(context, label: 'Loading'), + icon: knobBool(context, label: 'Icon') + ? CupertinoIcons.book + : null, + onPressed: knobBool(context, label: 'Enabled', initialValue: true) + ? () {} + : null, + ), + ); + }, + ), + WidgetbookUseCase( + name: 'All styles', + builder: (context) { + return IosPreview( + stretch: true, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + for (final style in AppButtonStyle.values) ...[ + AppButton(label: style.name, style: style, onPressed: () {}), + const SizedBox(height: AppSpacing.s3), + ], + ], + ), + ); + }, + ), + ], + ); +} diff --git a/widgetbook/lib/use_cases/atoms/text_fields_use_cases.dart b/widgetbook/lib/use_cases/atoms/text_fields_use_cases.dart new file mode 100644 index 0000000..24b6ea1 --- /dev/null +++ b/widgetbook/lib/use_cases/atoms/text_fields_use_cases.dart @@ -0,0 +1,32 @@ +import 'package:flutter/cupertino.dart'; +import 'package:sign_checker/ui/ui.dart'; +import 'package:sign_checker_widgetbook/knobs/common_knobs.dart'; +import 'package:sign_checker_widgetbook/support/preview.dart'; +import 'package:widgetbook/widgetbook.dart'; + +WidgetbookComponent textFieldsComponent() { + return WidgetbookComponent( + name: 'AppTextField', + useCases: [ + WidgetbookUseCase( + name: 'Search', + builder: (context) { + return IosPreview( + stretch: true, + child: AppTextField( + placeholder: knobText( + context, + label: 'Placeholder', + initialValue: 'Номер или название, например 3.27', + ), + prefixIcon: CupertinoIcons.search, + errorText: knobBool(context, label: 'Error') + ? 'Такого номера нет' + : null, + ), + ); + }, + ), + ], + ); +} diff --git a/widgetbook/lib/use_cases/atoms/typography_use_cases.dart b/widgetbook/lib/use_cases/atoms/typography_use_cases.dart new file mode 100644 index 0000000..36f474f --- /dev/null +++ b/widgetbook/lib/use_cases/atoms/typography_use_cases.dart @@ -0,0 +1,41 @@ +import 'package:flutter/widgets.dart'; +import 'package:sign_checker/theme/theme.dart'; +import 'package:sign_checker/ui/ui.dart'; +import 'package:sign_checker_widgetbook/support/preview.dart'; +import 'package:widgetbook/widgetbook.dart'; + +WidgetbookComponent typographyComponent() { + return WidgetbookComponent( + name: 'AppText', + useCases: [ + WidgetbookUseCase( + name: 'Scale', + builder: (context) { + return const IosPreview( + stretch: true, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText.largeTitle('Sign Detector'), + SizedBox(height: AppSpacing.s3), + AppText.title('Остановка запрещена'), + SizedBox(height: AppSpacing.s2), + AppText.headline('Что делать'), + SizedBox(height: AppSpacing.s2), + AppText.body( + 'Не останавливайтесь от знака до ближайшего перекрёстка.', + ), + SizedBox(height: AppSpacing.s2), + AppText.callout('3.27 · запрещающий'), + SizedBox(height: AppSpacing.s2), + AppText.footnote( + 'Подсказка, не замена ПДД. Решение за водителем.', + ), + ], + ), + ); + }, + ), + ], + ); +} diff --git a/widgetbook/lib/use_cases/molecules/list_tiles_use_cases.dart b/widgetbook/lib/use_cases/molecules/list_tiles_use_cases.dart new file mode 100644 index 0000000..6e3d8e7 --- /dev/null +++ b/widgetbook/lib/use_cases/molecules/list_tiles_use_cases.dart @@ -0,0 +1,46 @@ +import 'package:sign_checker/data/catalog/bundled_sign_catalog.dart'; +import 'package:sign_checker/presentation/catalog/sign_glyph.dart'; +import 'package:sign_checker/ui/ui.dart'; +import 'package:sign_checker_widgetbook/knobs/common_knobs.dart'; +import 'package:sign_checker_widgetbook/support/preview.dart'; +import 'package:widgetbook/widgetbook.dart'; + +WidgetbookComponent listTilesComponent() { + return WidgetbookComponent( + name: 'AppListTile', + useCases: [ + WidgetbookUseCase( + name: 'Sign row', + builder: (context) { + final sign = bundledSignCatalog.findByCode('3.27')!; + return IosPreview( + stretch: true, + child: AppListSection( + header: 'Запрещающие', + footer: knobText( + context, + label: 'Footer', + initialValue: 'Нажмите строку, чтобы открыть карточку.', + ), + separatorIndent: 76, + children: [ + AppListTile( + leading: SignGlyph(sign: sign), + title: sign.name, + subtitle: sign.action, + value: sign.code, + showChevron: knobBool( + context, + label: 'Chevron', + initialValue: true, + ), + onTap: () {}, + ), + ], + ), + ); + }, + ), + ], + ); +} diff --git a/widgetbook/lib/use_cases/screens/sign_screens_use_cases.dart b/widgetbook/lib/use_cases/screens/sign_screens_use_cases.dart new file mode 100644 index 0000000..380eacf --- /dev/null +++ b/widgetbook/lib/use_cases/screens/sign_screens_use_cases.dart @@ -0,0 +1,70 @@ +import 'package:sign_checker/data/catalog/bundled_sign_catalog.dart'; +import 'package:sign_checker/domain/detection_stabilizer.dart'; +import 'package:sign_checker/domain/norm_rect.dart'; +import 'package:sign_checker/presentation/camera/sign_panel.dart'; +import 'package:sign_checker/presentation/catalog/catalog_page.dart'; +import 'package:sign_checker/presentation/catalog/sign_detail_page.dart'; +import 'package:sign_checker_widgetbook/support/preview.dart'; +import 'package:widgetbook/widgetbook.dart'; + +WidgetbookComponent catalogScreenComponent() { + return WidgetbookComponent( + name: 'Catalog', + useCases: [ + WidgetbookUseCase( + name: 'Directory', + builder: (context) => const IosScreenPreview(child: CatalogPage()), + ), + ], + ); +} + +WidgetbookComponent signDetailScreenComponent() { + return WidgetbookComponent( + name: 'Sign detail', + useCases: [ + WidgetbookUseCase( + name: '3.27', + builder: (context) { + final sign = bundledSignCatalog.findByCode('3.27')!; + return IosScreenPreview(child: SignDetailPage(sign: sign)); + }, + ), + WidgetbookUseCase( + name: '3.24 speed', + builder: (context) { + final sign = bundledSignCatalog.findByCode('3.24')!; + return IosScreenPreview(child: SignDetailPage(sign: sign)); + }, + ), + ], + ); +} + +WidgetbookComponent signPanelComponent() { + return WidgetbookComponent( + name: 'Sign panel', + useCases: [ + WidgetbookUseCase( + name: 'Recognized 3.27', + builder: (context) { + final sign = bundledSignCatalog.findByCode('3.27')!; + final detection = SignDetection( + rawLabel: sign.code, + confidence: 0.86, + box: const NormRect(0.2, 0.2, 0.4, 0.4), + sign: sign, + ); + return IosPreview( + stretch: true, + child: SignPanel( + detections: [detection], + primary: detection, + onSelect: (_) {}, + ), + ); + }, + ), + ], + ); +} diff --git a/widgetbook/pubspec.lock b/widgetbook/pubspec.lock new file mode 100644 index 0000000..bc69d4f --- /dev/null +++ b/widgetbook/pubspec.lock @@ -0,0 +1,718 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + accessibility_tools: + dependency: transitive + description: + name: accessibility_tools + sha256: c29732e423175a51e0a6ace7df1255f5d77812c7c7b7101d8ba0186a43d533aa + url: "https://pub.dev" + source: hosted + version: "2.8.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + camera: + dependency: transitive + description: + name: camera + sha256: "3f30ca0ff376f91534f23afa2a7aea06ebb6c889fd9e260642437b37e3d9f753" + url: "https://pub.dev" + source: hosted + version: "0.12.1" + camera_android_camerax: + dependency: transitive + description: + name: camera_android_camerax + sha256: a9d527411429f97976dc1f97b0dbe57560c9d3ae482e2f45b7d0a2a61c6bf8f9 + url: "https://pub.dev" + source: hosted + version: "0.7.5" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: e409a731fad3fca10daa9567cf981720398659e6390f871a4e0f576058ff8940 + url: "https://pub.dev" + source: hosted + version: "0.10.3+1" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: "9365babc7488a9e93d0ed6dcccd917619fb12ea6f9e601519e1191d4890ee2fe" + url: "https://pub.dev" + source: hosted + version: "2.14.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: "5aecf1ac4dd4a949c5a7820e590020acb2bc35425384ab87a030e1739bfe12e2" + url: "https://pub.dev" + source: hosted + version: "0.3.5+6" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: "828110d598123b5ea96c00c9f3c72105bf79f8ee36c20a39b26209ade421ec57" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6 + url: "https://pub.dev" + source: hosted + version: "0.3.5+5" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: transitive + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + device_frame_plus: + dependency: transitive + description: + name: device_frame_plus + sha256: ccc94abccd4d9f0a9f19ef239001b3a59896e678ad42601371d7065889f2bf78 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "3854fe5e3bff0b113c658f260b90c95dea17c92db0f2addeac2e343dd9969785" + url: "https://pub.dev" + source: hosted + version: "2.0.35" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "35882981abcbfb8c15b286f0cd690ff25bac12d95eff3e25ee207f37d4c42e7f" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: ba03d03bcaa2f6cb7bd920e3b5027181db75ab524f8891c8bc3aa603885b8055 + url: "https://pub.dev" + source: hosted + version: "6.3.3" + hooks: + dependency: transitive + description: + name: hooks + sha256: eaac480a35ec0814146c2c48d96aaa829e0e44a7662c88ae84c9edf4bc35651f + url: "https://pub.dev" + source: hosted + version: "2.2.0" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + inspector: + dependency: transitive + description: + name: inspector + sha256: "60782d94c8851b0eee3ffdfea9fd43e7c37f919b54cb587e4de9da0e09d491b5" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + intl: + dependency: transitive + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" + jni: + dependency: transitive + description: + name: jni + sha256: f038e58b4dc2c9037f50e233175086337e0b305e356d28211bf55f21c504cbd3 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: b2310cdd4c18c65c081ab141a41efa94aa26c65431803703ece51996f174f351 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + jni_util: + dependency: transitive + description: + name: jni_util + sha256: "1ba86da04a5f2bf18fde2edb235587e70c5b0fc5bd4ba955f46b00942c3fc35f" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: ad56fd53a78ff6b1472fa59ff2a4e8b8ccabafc586fc263a1dfad0b99b5553e3 + url: "https://pub.dev" + source: hosted + version: "9.6.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "2f1564aadb14215e478563b5406cb80729d022158c01dc50c96013c2f7eb4790" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + platform: + dependency: transitive + description: + name: platform + sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec + url: "https://pub.dev" + source: hosted + version: "3.2.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + quiver: + dependency: transitive + description: + name: quiver + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + record_use: + dependency: transitive + description: + name: record_use + sha256: "1cb8564af8d43b464294411db9217f5ec04891c6f22ee2c32d73ae05e88a6bd2" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + resizable_widget: + dependency: transitive + description: + name: resizable_widget + sha256: db2919754b93f386b9b3fb15e9f48f6c9d6d41f00a24397629133c99df86606a + url: "https://pub.dev" + source: hosted + version: "1.0.5" + sign_checker: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "1.0.0+1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11" + url: "https://pub.dev" + source: hosted + version: "0.7.12" + tflite_flutter: + dependency: transitive + description: + name: tflite_flutter + sha256: "0bba9040d8decda0960d7abf8eabf32243bf092bc7d0084e8e19681866b0bdbe" + url: "https://pub.dev" + source: hosted + version: "0.12.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "611e87fb320b70d1dd721dc46af89c98aceccea9b31fde49e084591414e0c610" + url: "https://pub.dev" + source: hosted + version: "6.3.33" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "8faa1aab294f1ab4040b43660c887b0418d5fa4f0cffef76a484e6aa1092eb4a" + url: "https://pub.dev" + source: hosted + version: "6.4.2" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "10f86fef4c2c43563fa6c211ff9cf757adf4d3ab762c56bd430664a947d70cd0" + url: "https://pub.dev" + source: hosted + version: "3.2.3" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "5e835a3b869c2d70325349c81c5a45c28e20791265b67b2669da6b08c5cd5201" + url: "https://pub.dev" + source: hosted + version: "3.2.6" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "6c5ad3f22cd4c38e089b81963b3cd7bb83b111b2df5dce008bb066162f42e429" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "9d0e3b9cb16542ad660daee871e726a10d13a93b7b5391677c3160e8f5e83935" + url: "https://pub.dev" + source: hosted + version: "1.2.3" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + url: "https://pub.dev" + source: hosted + version: "1.1.13" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "4dca4feb77dc3ec7f6e27e49c53241eb8217f55e4f9b12599a27f8903bca5682" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "92b9910f66ed1057fd4da7b040ae7c74cafacf885bdc81be496928d5049b032d" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5f37239c4851efcef929cea7824e76df7f2f0970aef85d66bbc430afa40e72f0" + url: "https://pub.dev" + source: hosted + version: "15.3.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + widgetbook: + dependency: "direct main" + description: + name: widgetbook + sha256: "88b10102d294d0bec64ca294c81f15b1a620ce66df950067ff8f89274f1c95e8" + url: "https://pub.dev" + source: hosted + version: "3.25.0" + widgetbook_annotation: + dependency: transitive + description: + name: widgetbook_annotation + sha256: ec98130f23579f14e304b6b45516612676ae4e0b0e6bb1debe9dba4ea604ab42 + url: "https://pub.dev" + source: hosted + version: "3.11.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.4 <4.0.0" + flutter: ">=3.44.0" diff --git a/widgetbook/pubspec.yaml b/widgetbook/pubspec.yaml new file mode 100644 index 0000000..76350f2 --- /dev/null +++ b/widgetbook/pubspec.yaml @@ -0,0 +1,24 @@ +name: sign_checker_widgetbook +description: Widgetbook catalog for the Sign Detector UI kit +publish_to: "none" +version: 0.1.0+1 + +environment: + sdk: ^3.13.4 + +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + sign_checker: + path: ../ + widgetbook: ^3.14.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^6.0.0 + +flutter: + uses-material-design: true diff --git a/yolo11n.pt b/yolo11n.pt new file mode 100644 index 0000000..45b273b Binary files /dev/null and b/yolo11n.pt differ