Spaces:
Running
on
Zero
Running
on
Zero
2025-07-31 23:04 π
Browse files
app.py
CHANGED
@@ -665,16 +665,18 @@ select option[value*="ββββββ"] {
|
|
665 |
with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as demo:
|
666 |
gr.Markdown("""
|
667 |
# π― Crowd Counting by ZIP
|
668 |
-
### Upload an image and get precise crowd density predictions with
|
669 |
""")
|
670 |
|
671 |
# ζ·»ε δΏ‘ζ―ι’ζΏ
|
672 |
-
with gr.Accordion("βΉοΈ About ZIP
|
673 |
gr.Markdown("""
|
674 |
-
**ZIP (Zero-Inflated Poisson)**
|
675 |
-
|
676 |
-
- **
|
677 |
-
- **
|
|
|
|
|
678 |
|
679 |
Choose from different model variants: **ZIP-B** (Base), **ZIP-S** (Small), **ZIP-T** (Tiny), **ZIP-N** (Nano), **ZIP-P** (Pico)
|
680 |
""")
|
@@ -785,7 +787,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
|
|
785 |
gr.Markdown("""
|
786 |
### Step-by-step Guide:
|
787 |
|
788 |
-
1. **ποΈ Select Model**: Choose your preferred model variant, dataset, and metric from the dropdown
|
789 |
2. **πΈ Upload Image**: Click the image area to upload your crowd photo or use clipboard
|
790 |
3. **π Analyze**: Click the "Analyze Crowd" button to start processing
|
791 |
4. **π View Results**: Examine the density maps and crowd count in the output panels
|
@@ -793,16 +795,16 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
|
|
793 |
### Understanding the Outputs:
|
794 |
|
795 |
**π Main Results:**
|
796 |
-
- **π― Density Map**: Shows where people are located with color intensity
|
797 |
- **οΏ½ Predicted Count**: Total number of people detected in the image
|
798 |
|
799 |
**π Zero Analysis:**
|
800 |
-
- **ποΈ Structural Zero Map**:
|
801 |
-
- **π Sampling Zero Map**:
|
802 |
-
- **π― Complete Zero Map**:
|
803 |
|
804 |
**π― Hotspots:**
|
805 |
-
- **π Lambda Map**: Highlights crowd density
|
806 |
""")
|
807 |
|
808 |
# ζ·»ε ζζ―δΏ‘ζ―
|
@@ -810,15 +812,16 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
|
|
810 |
gr.Markdown("""
|
811 |
### Model Variants:
|
812 |
- **ZIP-B**: Base model with best performance
|
813 |
-
- **ZIP-S**:
|
814 |
- **ZIP-T**: Tiny model for resource-constrained environments
|
815 |
- **ZIP-N**: Nano model for mobile applications
|
816 |
- **ZIP-P**: Pico model for edge devices
|
817 |
|
818 |
### Datasets:
|
819 |
-
- **ShanghaiTech A
|
820 |
-
- **
|
821 |
-
- **
|
|
|
822 |
|
823 |
### Metrics:
|
824 |
- **MAE**: Mean Absolute Error - average counting error
|
|
|
665 |
with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as demo:
|
666 |
gr.Markdown("""
|
667 |
# π― Crowd Counting by ZIP
|
668 |
+
### Upload an image and get precise crowd density predictions with ZIP models!
|
669 |
""")
|
670 |
|
671 |
# ζ·»ε δΏ‘ζ―ι’ζΏ
|
672 |
+
with gr.Accordion("βΉοΈ About ZIP", open=False):
|
673 |
gr.Markdown("""
|
674 |
+
**ZIP (Zero-Inflated Poisson)** is a framework designed for crowd counting, a task where the goal is to estimate how many people are present in an image. It was introduced in the paper [ZIP: Scalable Crowd Counting via Zero-Inflated Poisson Modeling](https://arxiv.org/abs/2506.19955).
|
675 |
+
ZIP is based on a simple idea: not all empty areas in an image mean the same thing. Some regions are empty because there are truly no people there (like walls or sky), while others are places where people could appear but just happen not to in this particular image. ZIP separates these two cases using two prediction heads:
|
676 |
+
- **Structural Zeros**: These are regions that naturally never contain people (e.g., the background or torso areas). These are handled by the Ο head.
|
677 |
+
- **Sampling Zeros**: These are regions where people could appear but don't in this image. These are modeled by the Ξ» head.
|
678 |
+
|
679 |
+
By separating *where* people are likely to be from *how many* are present, ZIP produces more accurate and interpretable crowd estimates, especially in scenes with large empty spaces or varied crowd densities.
|
680 |
|
681 |
Choose from different model variants: **ZIP-B** (Base), **ZIP-S** (Small), **ZIP-T** (Tiny), **ZIP-N** (Nano), **ZIP-P** (Pico)
|
682 |
""")
|
|
|
787 |
gr.Markdown("""
|
788 |
### Step-by-step Guide:
|
789 |
|
790 |
+
1. **ποΈ Select Model**: Choose your preferred model variant, pre-trained dataset, and evaluation metric from the dropdown
|
791 |
2. **πΈ Upload Image**: Click the image area to upload your crowd photo or use clipboard
|
792 |
3. **π Analyze**: Click the "Analyze Crowd" button to start processing
|
793 |
4. **π View Results**: Examine the density maps and crowd count in the output panels
|
|
|
795 |
### Understanding the Outputs:
|
796 |
|
797 |
**π Main Results:**
|
798 |
+
- **π― Density Map**: Shows where people are located with color intensity, modeled by (1-Ο) * Ξ»
|
799 |
- **οΏ½ Predicted Count**: Total number of people detected in the image
|
800 |
|
801 |
**π Zero Analysis:**
|
802 |
+
- **ποΈ Structural Zero Map**: Indicates regions that structurally cannot contain head annotations (e.g., walls, sky, torso, or background). These are governed by the Ο head, which estimates the probability that a region never contains people.
|
803 |
+
- **π Sampling Zero Map**: Shows areas where people could be present but happen not to appear in the current image. These zeros are modeled by (1-Ο) * exp(-Ξ»), where the expected count Ξ» is near zero.
|
804 |
+
- **π― Complete Zero Map**: A combined visualization of zero probabilities, capturing both structural and sampling zeros. This map reflects overall non-crowd likelihood per region.
|
805 |
|
806 |
**π― Hotspots:**
|
807 |
+
- **π Lambda Map**: Highlights areas with high expected crowd density. Each value represents the expected number of people in that region, modeled by the Poisson intensity (Ξ»). This map focuses on *how many* people are likely to be present, assuming people could appear there.
|
808 |
""")
|
809 |
|
810 |
# ζ·»ε ζζ―δΏ‘ζ―
|
|
|
812 |
gr.Markdown("""
|
813 |
### Model Variants:
|
814 |
- **ZIP-B**: Base model with best performance
|
815 |
+
- **ZIP-S**: Small model for faster inference
|
816 |
- **ZIP-T**: Tiny model for resource-constrained environments
|
817 |
- **ZIP-N**: Nano model for mobile applications
|
818 |
- **ZIP-P**: Pico model for edge devices
|
819 |
|
820 |
### Datasets:
|
821 |
+
- **ShanghaiTech A**: Dense, low-resolution crowd scenes
|
822 |
+
- **ShanghaiTech B**: Sparse, high-resolution crowd scenes
|
823 |
+
- **UCF-QNRF**: Dense, ultra high-resolution crowd images
|
824 |
+
- **NWPU-Crowd**: Largest ultra high-resolution crowd counting dataset
|
825 |
|
826 |
### Metrics:
|
827 |
- **MAE**: Mean Absolute Error - average counting error
|