Detox: A Gray Box End-to-End Testing Framework for Mobile Apps
Detox is an open-source, end-to-end testing framework specifically designed for React Native applications. It offers a robust and reliable solution for automating your mobile app testing, ensuring high-quality user experiences.
What Does a Detox Test Look Like?
`javascript
describe('Login flow', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('should login successfully', async () => {
await element(by.id('email')).typeText('[email protected]');
await element(by.id('password')).typeText('123456');
const loginButton = element(by.text('Login'));
await loginButton.tap();
await expect(loginButton).not.toExist();
await expect(element(by.label('Welcome'))).toBeVisible();
});
});
`
This code snippet demonstrates a simple Detox test for a login screen. The test interacts with the app on a real device or simulator, mimicking the actions of a real user.
Get started with Detox now!
About Detox
Detox empowers mobile development teams to achieve high velocity by embracing continuous integration workflows. It eliminates the need for extensive manual QA testing by providing a powerful solution for automating end-to-end testing.
Key Features:
1. Real Device/Simulator Interaction: Detox tests your mobile app as it runs on a real device or simulator, interacting with it just like a real user.
2. Gray Box Testing: Detox embraces a gray box testing approach, providing a more robust and reliable testing environment than traditional black box testing.
3. Flakiness Mitigation: By shifting to gray box testing, Detox directly tackles the inherent flakiness often associated with end-to-end tests.
Supported React Native Versions
Detox provides official support for React Native versions 0.71.x, 0.72.x, and 0.73.x without React Native's "New Architecture". While newer versions and "New Architecture" may work with Detox, they have not yet been fully tested by the Detox team.
Although Detox does not officially support older React Native versions, the team strives to maintain compatibility. If you encounter any issues with an unsupported version, please open an issue or reach out on the Detox Discord server for assistance.
Known Issues with React Native
Detox continuously monitors and addresses any known issues that might arise with React Native. You can find detailed information about these issues and their workarounds on the official Detox documentation.
Get Started with Detox
To start using Detox for your React Native app, follow the comprehensive Getting Started Guide on the Detox website. This guide will walk you through the setup process, ensuring you have Detox running within minutes.
Documents Site
Explore the complete Detox documentation, including in-depth guides, API references, and troubleshooting tips, on the official Detox website.
Core Principles of Detox
Detox challenges traditional end-to-end testing principles, adopting a fresh perspective to address the inherent difficulties of mobile testing. Learn about these unique principles on the Detox website.
Contributing to Detox
Detox is an open-source project, and your contributions are highly valued. Explore issues tagged with the "help wanted" label on the Detox repository to find areas where your skills can make a difference.
If you encounter a bug or have a new feature suggestion, open an issue on the Detox repository. To dive into the core of Detox and contribute to its development, refer to the Detox Contribution Guide.
License
Detox is released under the Apache-2.0 license.
Darknet Object Detection Framework and YOLO
Downcodes小编 brings you an insightful exploration of the powerful Darknet object detection framework and its acclaimed YOLO (You Only Look Once) algorithm. This comprehensive guide delves into the key aspects of this widely adopted system, empowering you to harness its capabilities for various object detection tasks.
Let's begin!
Darknet: The Framework
Darknet is an open-source neural network framework written in C, C++, and CUDA. It offers high performance and flexibility, making it a popular choice for researchers and developers working with object detection and other computer vision tasks.
YOLO: The Algorithm
YOLO (You Only Look Once) is a real-time object detection algorithm that operates within the Darknet framework. Its innovative approach allows it to process images in a single pass, enabling fast and accurate object detection.
Hank.ai's Support for Darknet/YOLO
Hank.ai, a leading AI company, plays a significant role in supporting the Darknet/YOLO community, ensuring its continued development and accessibility.
Announcing Darknet V3 "Jazz"
The latest release of Darknet, version 3.x, aptly named "Jazz," introduces a range of enhancements and improvements, including:
Enhanced Performance: Darknet V3 boasts impressive performance gains, allowing it to process images and videos at an even faster rate.
New API: The introduction of a new C and C++ API further simplifies the integration of Darknet into your applications.
Expanded Examples: The inclusion of new sample code and applications within the src-examples directory provides more hands-on learning opportunities.
Darknet/YOLO Resources
Official Website: https://darknetcv.ai
FAQ: Find answers to common questions and learn more about Darknet/YOLO.
Discord Server: Join the active Darknet/YOLO community on Discord for discussions, support, and collaboration.
Papers
YOLOv7: https://arxiv.org/abs/2207.02662
Scaled-YOLOv4: https://arxiv.org/abs/2102.05909
YOLOv4: https://arxiv.org/abs/2004.10934
YOLOv3: https://pjreddie.com/media/files/papers/YOLOv3.pdf
General Information
Speed and Accuracy: Darknet/YOLO consistently outperforms other object detection frameworks in terms of speed and accuracy.
Open Source: The framework and its associated algorithms are completely open source, allowing free use and customization.
Cross-Platform Support: Darknet/YOLO runs seamlessly on various platforms, including Linux, Windows, and macOS.
Darknet Version
The Darknet project has undergone multiple iterations, with each version introducing new features and refinements.
Version 0.x: The original Darknet tool developed by Joseph Redmon.
Version 1.x: Maintained by Alexey Bochkovskiy.
Version 2.x "OAK": Sponsored by Hank.ai and maintained by Stéphane Charette.
Version 3.x "JAZZ": The latest version, introducing a comprehensive API and performance improvements.
MSCOCO Pre-trained Weights
To get started quickly, Darknet/YOLO offers pre-trained weights for various YOLO versions trained on the popular MSCOCO dataset, which includes 80 common object classes.
Pre-trained weights for:
1. YOLOv2
2. YOLOv3
3. YOLOv4
4. YOLOv7
These pre-trained weights are available for download on the Darknet repository.
Example Usage:
`bash
Download pre-trained weights (YOLOv4-tiny)
wget --no-clobber https://github.com/hank-ai/darknet/releases/download/v2.0/yolov4-tiny.weights
Run object detection on an image
darknet02displayannotatedimages coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg
Run object detection on a video
darknet03display_videos coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi
`
Building Darknet
Darknet requires C++17 or newer, OpenCV, and uses CMake for building.
Building options:
1. Google Colab: Use the same instructions as for Linux.
2. Linux CMake Method:
* Prerequisites:
* build-essential, git, libopencv-dev, cmake (install using your distribution's package manager)
* CUDA (optional): For GPU acceleration. Download and install from https://developer.nvidia.com/cuda-downloads.
* cuDNN (optional): Download and install from https://developer.nvidia.com/rdp/cudnn-download or https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#cudnn-package-manager-installation-overview.
* Build Steps:
`bash
mkdir ~/srccd ~/src
git clone https://github.com/hank-ai/darknet
cd darknet
mkdir build
cd build
cmake -DCMAKEBUILDTYPE=Release ..
make -j4 package
sudo dpkg -i darknet-VERSION.deb
`
3. Windows CMake Method:
* Prerequisites:
* Git, CMake, NSIS, Visual Studio 2022 Community: Install using winget.
* Microsoft VCPKG: Install to build OpenCV.
* Build Steps:
`bash
cd c:
mkdir c:src
cd c:src
git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
.vcpkg.exe integrate install
.vcpkg.exe integrate powershell
.vcpkg.exe install opencv[contrib,dnn,freetype,jpeg,openmp,png,webp,world]:x64-windows
cd ..
git clone https://github.com/hank-ai/darknet.git
cd darknet
mkdir build
cd build
cmake -DCMAKEBUILDTYPE=Release -DCMAKETOOLCHAINFILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake ..
msbuild.exe /property:Platform=x64;Configuration=Release /target:Build -maxCpuCount -verbosity:normal -detailedSummary darknet.sln
msbuild.exe /property:Platform=x64;Configuration=Release PACKAGE.vcxproj
`
Using Darknet
CLI: Darknet provides a command-line interface for various tasks, including:
* Object Detection: Detect objects in images and videos.
* Training: Train custom object detection models.
* Performance Evaluation: Measure the accuracy of your models.
DarkHelp: DarkHelp is an alternative, robust CLI with additional features like object tracking and tiling.
Example CLI Commands:
`bash
Check the Darknet version
darknet version
Run object detection on an image
darknet detector test cars.data cars.cfg cars_best.weights image1.jpg
Train a new network
darknet detector -map -dont_show train animals.data animals.cfg
`
Training
DarkMark: A tool for annotating images, generating training data, and managing your Darknet/YOLO projects.
Manual Setup: For more control, you can manually create the necessary files for training, including:
* Configuration File (.cfg): Defines the network architecture and hyperparameters.
* Names File (.names): Lists the object classes you want to detect.
* Data File (.data): Specifies the training and validation datasets.
* Annotation Files (.txt): Contain bounding box coordinates for your training images.
Steps for Manual Training:
1. Prepare Training Data: Annotate your images using DarkMark or another annotation tool.
2. Create Configuration File: Copy an existing configuration file (e.g., yolov4-tiny.cfg) and modify it for your specific dataset.
3. Create Names File: List your object classes in a text file.
4. Create Data File: Specify paths to your training and validation datasets.
5. Train the Model:
`bash
darknet detector -map -dont_show train animals.data animals.cfg
`
Other Tools and Links
DarkHelp: https://github.com/hank-ai/darkhelp
Darknet/YOLO FAQ: https://darknetcv.ai/faq
Stéphane's YouTube Channel: https://www.youtube.com/channel/UC3c1x727824J8oV8YfH57A
Darknet/YOLO Discord Server: https://discord.gg/zSq8rtW
Roadmap
Short-term goals:
Improve command-line parsing for better user experience.
Optimize code for improved performance.
Enhance code consistency and readability.
Mid-term goals:
Replace char with std::string for enhanced code safety.
Optimize the use of cv::Mat for efficient image processing.
Expand support for image formats and channels.
Long-term goals:
Add support for non-NVIDIA GPUs.
Introduce rotated bounding boxes and angle support.
Implement keypoints/skeletons and heatmaps for more complex object detection.
Explore segmentation capabilities.
Conclusion
Darknet and YOLO have revolutionized the field of object detection, offering a powerful and flexible framework for researchers, developers, and enthusiasts alike. By embracing its open-source nature, exploring the available resources, and participating in the active community, you can leverage Darknet/YOLO for a wide range of innovative applications.
Downcodes小编 hopes this comprehensive guide has equipped you with a solid understanding of Darknet and YOLO, enabling you to embark on your journey of object detection with confidence!