Overview of EfficientNets for PyTorch implementation
mainGenEfficientNet or MobileNetV3 classes, utilizing string-based architecture definitions to configure block layouts.repository·main·Indexed 12 days ago
https://github.com/lllyasviel/stable-diffusion-webui-forgeAn optimized platform for Stable Diffusion designed to improve resource management, increase inference speed, and facilitate development. It serves as a performance-oriented version of the original SD-WebUI, incorporating experimental features and optimizations.
GenEfficientNet or MobileNetV3 classes, utilizing string-based architecture definitions to configure block layouts.llama.cpp's GGUF, Forge's version is specifically extended to support PyTorch quantization and dequantization (quant/dequant).The implementation supports a wide variety of pretrained models, including:
EfficientNet weights ported from TensorFlow checkpoints require specific preprocessing to match original accuracy.
Key Requirements:
EfficientNet AdvProp (AP), EfficientNet EdgeTPU, EfficientNet-CondConv, EfficientNet-Lite, and MobileNet-V3 models, use Inception-style mean and standard deviation: mean=0.5, std=0.5.--tf-preprocessing flag during validation can improve scores by 0.1-0.5%, bringing results closer to the original TensorFlow implementation.SAME convolution padding equivalents, specific crop factors, and image scaling as defined in the model's configuration.MiDaS computes depth from a single image using the following ROS topic interface:
image_topic): Expects a sensor_msgs/Image message of type RGB8. The image can have any shape.midas_topic): Emits a sensor_msgs/Image message of type TYPE_32FC1. This contains inverse relative depth maps in the range [0 - 255] with the original image size and channels=1.To use MiDaS for monocular depth estimation, follow these setup steps:
Install Dependencies: Use Conda to create the environment from the provided YAML file.
conda env create -f environment.yaml
conda activate midas-py310Optional Components:
git submodule add https://github.com/isl-org/Next-ViT midas/external/next_vitpip install openvinoDownload Weights: Download the desired model weights and place them in the weights folder.
# No single runnable setup command, but provides the sequence:
conda env create -f environment.yaml
conda activate midas-py310If you prefer using Docker with NVIDIA GPU support:
Build the image:
docker build -t midas .Run inference:
Mount your local input, output, and weights directories to the container:
docker run --rm --gpus all -v $PWD/input:/opt/MiDaS/input -v $PWD/output:/opt/MiDaS/output -v $PWD/weights:/opt/MiDaS/weights midasdocker run --rm --gpus all -v $PWD/input:/opt/MiDaS/input -v $PWD/output:/opt/MiDaS/output -v $PWD/weights:/opt/MiDaS/weights midasUse the validate.py script to run validation on ImageNet datasets. Different models require different arguments for image size, crop percentage, and preprocessing.
Standard validation (e.g., tf_efficientnet_b5):
python validate.py /path/to/imagenet/validation/ --model tf_efficientnet_b5 -b 64 --img-size 456 --crop-pct 0.934 --interpolation bicubicValidation with TensorFlow preprocessing:
python validate.py /path/to/imagenet/validation/ --model tf_efficientnet_b5 -b 64 --img-size 456 --tf-preprocessingValidation for models with Inception preprocessing (e.g., EfficientNet-B8 AdvProp):
python validate.py /path/to/imagenet/validation/ --model tf_efficientnet_b8_ap -b 48 --num-gpu 2 --img-size 672 --crop-pct 0.954 --mean 0.5 --std 0.5python validate.py /path/to/imagenet/validation/ --model tf_efficientnet_b5 -b 64 --img-size 456 --crop-pct 0.934 --interpolation bicubicTo start the MiDaS node, execute the launch script from your catkin workspace:
~/catkin_ws/src/launch_midas_cpp.shTo verify the installation using a video file:
test.mp4 into the ~/catkin_ws/src/ directory.~/catkin_ws/src/launch_midas_cpp.sh.cd ~/catkin_ws/src && ./run_talker_listener_test.shWait approximately 30 seconds for the test to complete.Note: If you need to use Python 2 instead of Python 3, run:
sed -i 's/python3/python2/' ~/catkin_ws/src/midas_cpp/scripts/*.py
# Run the midas node
~/catkin_ws/src/launch_midas_cpp.sh
# Run test nodes in another terminal
cd ~/catkin_ws/src && ./run_talker_listener_test.shEfficientNets can be installed via pip after setting up a Conda environment with PyTorch. The package is named geffnet.
Recommended Environment Setup:
pip install geffnetconda create -n torch-env
conda activate torch-env
conda install -c pytorch pytorch torchvision cudatoolkit=10.2
pip install geffnetTo extend the Detectron2 layers with a new operation (Op), follow these steps:
vision.cpp.