Skip to content

Instantly share code, notes, and snippets.

View bindbox.dart
import 'package:flutter/material.dart';
import 'dart:math' as math;
class BndBox extends StatelessWidget {
final List<dynamic> results;
final int previewH;
final int previewW;
final double screenH;
final double screenW;
final String model;
View camera.dart
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:tflite/tflite.dart';
import 'dart:math' as math;
typedef void Callback(List<dynamic> list, int h, int w);
class Camera extends StatefulWidget {
final List<CameraDescription> cameras;
final Callback setRecognitions;
View home.dart
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:tflite/tflite.dart';
import 'dart:math' as math;
import 'camera.dart';
import 'bndbox.dart';
import 'models.dart';
class HomePage extends StatefulWidget {
View main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite/tflite.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
));
class MyApp extends StatefulWidget {
View prediction_widget.dart
class PredictionWidget extends StatelessWidget {
final List<Prediction> predictions;
const PredictionWidget({Key key, this.predictions}) : super(key: key);
Widget _numberWidget(int num, Prediction prediction) {
return Column(
children: <Widget>[
Text(
'$num',
View prediction.dart
class Prediction {
final double confidence;
final int index;
final String label;
Prediction({this.confidence, this.index, this.label});
factory Prediction.fromJson(Map<dynamic, dynamic> json) {
return Prediction(
confidence: json['confidence'],
View recognizer.dart
final _canvasCullRect = Rect.fromPoints(
Offset(0, 0),
Offset(Constants.imageSize, Constants.imageSize),
);
final _whitePaint = Paint()
..strokeCap = StrokeCap.round
..color = Colors.white
..strokeWidth = Constants.strokeWidth;
View drawing_painter.dart
class DrawingPainter extends CustomPainter {
final List<Offset> points;
DrawingPainter(this.points);
final Paint _paint = Paint()
..strokeCap = StrokeCap.round
..color = Colors.blue
..strokeWidth = Constants.strokeWidth;
View draw_screen.dart
class DrawScreen extends StatefulWidget {
@override
_DrawScreenState createState() => _DrawScreenState();
}
class _DrawScreenState extends State<DrawScreen> {
final _points = List<Offset>();
final _recognizer = Recognizer();
List<Prediction> _prediction;
bool initialize = false;
View object detection.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.