help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
action-recognition
RSK World
action-recognition
Action Recognition Dataset - Video Classification + Action AI + Video ML
action-recognition
  • annotations
  • sample_data
  • .gitignore1.2 KB
  • LICENSE.txt3.3 KB
  • README.md13.1 KB
  • RELEASE_NOTES.md4 KB
  • action-recognition.png150.5 KB
  • api_server.py16.1 KB
  • augmentation.py15.9 KB
  • benchmark.py20.6 KB
  • config.json2.8 KB
  • convert_videos.py3.5 KB
  • create_logo.py5.5 KB
  • demo.html28.3 KB
  • download_real_human_videos.py12.6 KB
  • download_real_videos.py21.1 KB
  • download_ucf101.py19.6 KB
  • download_youtube_videos.py10.1 KB
  • favicon.png786 B
  • generate_browser_videos.py10.7 KB
  • generate_samples.py19.4 KB
  • get_real_videos.py8.2 KB
  • index.html38.8 KB
  • loader.py8.9 KB
  • logo.png8.5 KB
  • process_downloaded.py4.6 KB
  • real_running_preview.png195.6 KB
  • real_video_preview.png330.6 KB
  • realtime_predictor.py14.3 KB
  • requirements.txt1.9 KB
  • script.js13.8 KB
  • styles.css39.4 KB
  • train_model.py20.5 KB
  • video_preview.png61.3 KB
  • visualize_dataset.py18 KB
download_real_videos.py
download_real_videos.py
Raw Download
Find: Go to:
"""
==================================================================================
    Action Recognition Dataset - Real Video Downloader
==================================================================================
    Project: Action Recognition Dataset
    Category: Video Data / Data Science
    
    This script downloads REAL action recognition videos from public sources.
    
==================================================================================
    DEVELOPER INFORMATION
==================================================================================
    Website: RSK World (https://rskworld.in)
    Founded by: Molla Samser
    Designer & Tester: Rima Khatun
    
    Contact Information:
    - Email: help@rskworld.in
    - Email: support@rskworld.in
    - Phone: +91 93305 39277
    
==================================================================================
    COPYRIGHT
==================================================================================
    (c) 2026 RSK World. All Rights Reserved.
    
==================================================================================

Usage:
    pip install yt-dlp opencv-python
    python download_real_videos.py
    
This downloads real action videos and adds RSK World branding.
"""

import os
import subprocess
import sys
from pathlib import Path
import json
import shutil

# Try to import required libraries
try:
    import cv2
    import numpy as np
except ImportError:
    print("Installing required packages...")
    subprocess.check_call([sys.executable, "-m", "pip", "install", "opencv-python", "numpy"])
    import cv2
    import numpy as np

try:
    import yt_dlp
except ImportError:
    print("Installing yt-dlp...")
    subprocess.check_call([sys.executable, "-m", "pip", "install", "yt-dlp"])
    import yt_dlp


# ==================================================================================
# Configuration
# ==================================================================================

# RSK World Branding Colors (BGR for OpenCV)
LOGO_COLOR = (255, 212, 0)  # Cyan
TEXT_COLOR = (255, 255, 255)  # White
BG_OVERLAY = (0, 0, 0)  # Black for watermark background

# Output settings
OUTPUT_DIR = Path("sample_data")
MAX_DURATION = 5  # Max video duration in seconds
TARGET_SIZE = (640, 480)  # Target video resolution

# Real video sources - Creative Commons / Public Domain videos
# These are short clips from Pexels (free to use)
VIDEO_SOURCES = {
    "walking": [
        {
            "url": "https://www.pexels.com/download/video/4720735/",
            "source": "pexels",
            "id": "walking_001"
        },
        {
            "url": "https://www.pexels.com/download/video/6387101/",
            "source": "pexels", 
            "id": "walking_002"
        }
    ],
    "running": [
        {
            "url": "https://www.pexels.com/download/video/5319934/",
            "source": "pexels",
            "id": "running_001"
        },
        {
            "url": "https://www.pexels.com/download/video/4761437/",
            "source": "pexels",
            "id": "running_002"
        }
    ],
    "jumping": [
        {
            "url": "https://www.pexels.com/download/video/4761554/",
            "source": "pexels",
            "id": "jumping_001"
        }
    ],
    "dancing": [
        {
            "url": "https://www.pexels.com/download/video/6394054/",
            "source": "pexels",
            "id": "dancing_001"
        }
    ],
    "exercising": [
        {
            "url": "https://www.pexels.com/download/video/4761671/",
            "source": "pexels",
            "id": "exercising_001"
        }
    ]
}

# Alternative: YouTube video IDs (Creative Commons)
YOUTUBE_VIDEOS = {
    "walking": [
        {"id": "dQw4w9WgXcQ", "start": 0, "end": 5, "name": "walking_yt_001"},  # placeholder
    ],
    "running": [
        {"id": "dQw4w9WgXcQ", "start": 0, "end": 5, "name": "running_yt_001"},
    ]
}


# ==================================================================================
# RSK World Branding Functions
# ==================================================================================

def add_watermark(frame, action_name):
    """
    Add RSK World watermark and action label to frame
    
    RSK World (https://rskworld.in)
    Founder: Molla Samser
    """
    h, w = frame.shape[:2]
    
    # Create overlay for watermark
    overlay = frame.copy()
    
    # Bottom bar for action label
    bar_height = 50
    cv2.rectangle(overlay, (0, h - bar_height), (w, h), BG_OVERLAY, -1)
    
    # Top right logo area
    logo_width = 180
    logo_height = 35
    cv2.rectangle(overlay, (w - logo_width - 10, 5), (w - 5, logo_height + 10), BG_OVERLAY, -1)
    
    # Blend overlay
    alpha = 0.6
    cv2.addWeighted(overlay, alpha, frame, 1 - alpha, 0, frame)
    
    # Draw RSK World logo text
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(frame, "RSK", (w - logo_width, 28), font, 0.6, TEXT_COLOR, 1, cv2.LINE_AA)
    cv2.putText(frame, "World", (w - logo_width + 40, 28), font, 0.6, LOGO_COLOR, 1, cv2.LINE_AA)
    cv2.putText(frame, ".in", (w - logo_width + 100, 28), font, 0.5, (150, 150, 150), 1, cv2.LINE_AA)
    
    # Draw action label
    label = action_name.upper()
    label_size = cv2.getTextSize(label, font, 0.9, 2)[0]
    label_x = (w - label_size[0]) // 2
    cv2.putText(frame, label, (label_x, h - 18), font, 0.9, LOGO_COLOR, 2, cv2.LINE_AA)
    
    # Draw copyright
    copyright_text = "rskworld.in"
    cv2.putText(frame, copyright_text, (10, h - 18), font, 0.4, (150, 150, 150), 1, cv2.LINE_AA)
    
    return frame


def process_video(input_path, output_path, action_name, max_duration=5):
    """
    Process video: resize, trim, and add RSK World branding
    
    RSK World (https://rskworld.in)
    Contact: help@rskworld.in
    """
    print(f"    Processing: {input_path}")
    
    cap = cv2.VideoCapture(str(input_path))
    
    if not cap.isOpened():
        print(f"    [ERROR] Cannot open video: {input_path}")
        return False
    
    # Get video properties
    fps = int(cap.get(cv2.CAP_PROP_FPS)) or 30
    total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
    max_frames = min(total_frames, fps * max_duration)
    
    # Create video writer
    fourcc = cv2.VideoWriter_fourcc(*'mp4v')
    out = cv2.VideoWriter(str(output_path), fourcc, fps, TARGET_SIZE)
    
    frame_count = 0
    while frame_count < max_frames:
        ret, frame = cap.read()
        if not ret:
            break
        
        # Resize frame
        frame = cv2.resize(frame, TARGET_SIZE)
        
        # Add watermark
        frame = add_watermark(frame, action_name)
        
        out.write(frame)
        frame_count += 1
    
    cap.release()
    out.release()
    
    print(f"    [OK] Saved: {output_path} ({frame_count} frames)")
    return True


# ==================================================================================
# Video Download Functions
# ==================================================================================

def download_with_ytdlp(url, output_path, max_duration=10):
    """
    Download video using yt-dlp
    
    RSK World (https://rskworld.in)
    """
    ydl_opts = {
        'format': 'best[height<=480]',
        'outtmpl': str(output_path),
        'quiet': True,
        'no_warnings': True,
        'extract_flat': False,
    }
    
    try:
        with yt_dlp.YoutubeDL(ydl_opts) as ydl:
            ydl.download([url])
        return True
    except Exception as e:
        print(f"    [ERROR] Download failed: {e}")
        return False


def download_pexels_video(video_id, output_path):
    """
    Download video from Pexels using their API or direct link
    
    RSK World (https://rskworld.in)
    """
    import urllib.request
    
    # Pexels direct download URLs
    url = f"https://player.vimeo.com/external/{video_id}.sd.mp4"
    
    try:
        urllib.request.urlretrieve(url, output_path)
        return True
    except Exception as e:
        print(f"    [ERROR] Pexels download failed: {e}")
        return False


# ==================================================================================
# Sample Video Creation (Fallback with real-looking data)
# ==================================================================================

def create_realistic_sample(output_path, action_name, sample_num):
    """
    Create a realistic-looking sample video with motion blur and realistic colors
    This is used as fallback when downloads fail
    
    RSK World (https://rskworld.in)
    Founder: Molla Samser
    """
    print(f"    Creating realistic sample for {action_name}...")
    
    fps = 30
    duration = 4
    num_frames = fps * duration
    
    fourcc = cv2.VideoWriter_fourcc(*'mp4v')
    out = cv2.VideoWriter(str(output_path), fourcc, fps, TARGET_SIZE)
    
    # Create realistic background with gradient
    np.random.seed(sample_num * 100 + hash(action_name) % 1000)
    
    # Background colors for different environments
    environments = [
        {"sky": (180, 130, 100), "ground": (60, 80, 60)},  # Outdoor park
        {"sky": (200, 200, 200), "ground": (100, 100, 100)},  # Indoor gym
        {"sky": (255, 200, 150), "ground": (80, 60, 40)},  # Sunset outdoor
        {"sky": (150, 150, 180), "ground": (70, 70, 80)},  # Urban
    ]
    env = environments[sample_num % len(environments)]
    
    # Person silhouette parameters
    person_x = TARGET_SIZE[0] // 2
    person_base_y = TARGET_SIZE[1] - 100
    
    for frame_num in range(num_frames):
        # Create gradient background
        frame = np.zeros((TARGET_SIZE[1], TARGET_SIZE[0], 3), dtype=np.uint8)
        
        for y in range(TARGET_SIZE[1]):
            ratio = y / TARGET_SIZE[1]
            color = tuple(int(env["sky"][i] * (1 - ratio) + env["ground"][i] * ratio) for i in range(3))
            frame[y, :] = color
        
        # Add some noise for realism
        noise = np.random.randint(-10, 10, frame.shape, dtype=np.int16)
        frame = np.clip(frame.astype(np.int16) + noise, 0, 255).astype(np.uint8)
        
        # Draw realistic human silhouette
        progress = frame_num / num_frames
        cycle = (frame_num % 20) / 20.0 * 2 * np.pi
        
        # Calculate pose based on action
        if action_name == "walking":
            leg_swing = 15 * np.sin(cycle)
            arm_swing = 20 * np.sin(cycle)
            body_bob = 3 * abs(np.sin(cycle * 2))
            x_offset = int(100 * np.sin(progress * np.pi))
        elif action_name == "running":
            leg_swing = 30 * np.sin(cycle * 2)
            arm_swing = 40 * np.sin(cycle * 2)
            body_bob = 8 * abs(np.sin(cycle * 4))
            x_offset = int(150 * np.sin(progress * np.pi))
        elif action_name == "jumping":
            jump_cycle = (frame_num % 45) / 45.0
            if jump_cycle < 0.4:
                body_bob = -30 * jump_cycle / 0.4
            elif jump_cycle < 0.7:
                body_bob = -30 - 80 * np.sin((jump_cycle - 0.4) / 0.3 * np.pi)
            else:
                body_bob = -30 * (1 - (jump_cycle - 0.7) / 0.3)
            leg_swing = 0
            arm_swing = -60 if jump_cycle < 0.6 else 0
            x_offset = 0
        elif action_name == "waving":
            arm_swing = -90 + 30 * np.sin(cycle * 3)
            leg_swing = 0
            body_bob = 0
            x_offset = 0
        elif action_name == "dancing":
            leg_swing = 20 * np.sin(cycle * 1.5)
            arm_swing = 45 * np.sin(cycle * 2)
            body_bob = 10 * np.sin(cycle * 2)
            x_offset = int(30 * np.sin(cycle))
        elif action_name == "exercising":
            # Jumping jacks style
            cycle2 = (frame_num % 30) / 30.0
            if cycle2 < 0.5:
                arm_swing = -90 * (cycle2 * 2)
                leg_swing = 30 * (cycle2 * 2)
            else:
                arm_swing = -90 * (1 - (cycle2 - 0.5) * 2)
                leg_swing = 30 * (1 - (cycle2 - 0.5) * 2)
            body_bob = 5 * np.sin(cycle * 4)
            x_offset = 0
        elif action_name == "sitting":
            progress_sit = min(1.0, frame_num / (num_frames * 0.3))
            body_bob = 60 * progress_sit
            leg_swing = 45 * progress_sit
            arm_swing = 30 * progress_sit
            x_offset = 0
        elif action_name == "standing":
            progress_stand = min(1.0, frame_num / (num_frames * 0.3))
            body_bob = 60 * (1 - progress_stand)
            leg_swing = 45 * (1 - progress_stand)
            arm_swing = 30 * (1 - progress_stand)
            x_offset = 0
        else:
            leg_swing = 10 * np.sin(cycle)
            arm_swing = 15 * np.sin(cycle)
            body_bob = 0
            x_offset = 0
        
        # Draw person silhouette (more realistic shape)
        px = person_x + x_offset
        py = int(person_base_y + body_bob)
        
        # Person color (realistic skin/clothing)
        person_colors = [
            (80, 100, 140),   # Blue clothing
            (60, 60, 80),     # Dark clothing
            (100, 80, 60),    # Brown clothing
            (70, 90, 70),     # Green clothing
        ]
        person_color = person_colors[sample_num % len(person_colors)]
        skin_color = (140, 180, 220)  # Skin tone
        
        # Head
        head_radius = 25
        cv2.circle(frame, (px, py - 140), head_radius, skin_color, -1)
        cv2.circle(frame, (px, py - 140), head_radius, (100, 130, 160), 2)
        
        # Body (torso)
        torso_pts = np.array([
            [px - 25, py - 115],
            [px + 25, py - 115],
            [px + 20, py - 40],
            [px - 20, py - 40]
        ], np.int32)
        cv2.fillPoly(frame, [torso_pts], person_color)
        
        # Arms
        arm_length = 50
        # Left arm
        left_arm_angle = np.radians(arm_swing + 90)
        left_arm_end = (
            int(px - 25 + arm_length * np.cos(left_arm_angle)),
            int(py - 100 + arm_length * np.sin(left_arm_angle))
        )
        cv2.line(frame, (px - 25, py - 100), left_arm_end, person_color, 12)
        cv2.circle(frame, left_arm_end, 8, skin_color, -1)
        
        # Right arm
        right_arm_angle = np.radians(-arm_swing + 90)
        right_arm_end = (
            int(px + 25 + arm_length * np.cos(right_arm_angle)),
            int(py - 100 + arm_length * np.sin(right_arm_angle))
        )
        cv2.line(frame, (px + 25, py - 100), right_arm_end, person_color, 12)
        cv2.circle(frame, right_arm_end, 8, skin_color, -1)
        
        # Legs
        leg_length = 55
        # Left leg
        left_leg_angle = np.radians(leg_swing + 90)
        left_leg_end = (
            int(px - 10 + leg_length * np.sin(np.radians(leg_swing))),
            int(py - 40 + leg_length * np.cos(np.radians(abs(leg_swing))))
        )
        cv2.line(frame, (px - 10, py - 40), left_leg_end, (50, 50, 60), 14)
        
        # Right leg  
        right_leg_end = (
            int(px + 10 - leg_length * np.sin(np.radians(leg_swing))),
            int(py - 40 + leg_length * np.cos(np.radians(abs(leg_swing))))
        )
        cv2.line(frame, (px + 10, py - 40), right_leg_end, (50, 50, 60), 14)
        
        # Feet
        cv2.ellipse(frame, left_leg_end, (12, 6), 0, 0, 360, (40, 40, 50), -1)
        cv2.ellipse(frame, right_leg_end, (12, 6), 0, 0, 360, (40, 40, 50), -1)
        
        # Add motion blur effect for realism
        if action_name in ["running", "jumping", "dancing"]:
            kernel_size = 5
            frame = cv2.GaussianBlur(frame, (kernel_size, kernel_size), 0)
        
        # Add watermark
        frame = add_watermark(frame, action_name)
        
        out.write(frame)
    
    out.release()
    print(f"    [OK] Created: {output_path}")
    return True


# ==================================================================================
# Main Functions
# ==================================================================================

def create_directory_structure():
    """Create the sample data directory structure"""
    actions = ["walking", "running", "jumping", "waving", "sitting", 
               "standing", "dancing", "exercising"]
    
    for split in ["train", "val", "test"]:
        for action in actions:
            dir_path = OUTPUT_DIR / split / action
            dir_path.mkdir(parents=True, exist_ok=True)
    
    print("[OK] Directory structure created")


def generate_all_samples():
    """
    Generate all sample videos with real-looking content
    
    RSK World (https://rskworld.in)
    Founder: Molla Samser
    Designer: Rima Khatun
    Contact: help@rskworld.in | +91 93305 39277
    """
    print("=" * 60)
    print("Action Recognition Dataset - Real Video Generator")
    print("=" * 60)
    print("Website: https://rskworld.in")
    print("Founder: Molla Samser")
    print("Designer: Rima Khatun")
    print("Contact: help@rskworld.in | +91 93305 39277")
    print("=" * 60)
    print()
    
    # Create directories
    create_directory_structure()
    print()
    
    # Action classes
    actions = ["walking", "running", "jumping", "waving", "sitting", 
               "standing", "dancing", "exercising"]
    
    # Samples per split
    splits = {
        "train": 3,
        "val": 1,
        "test": 1
    }
    
    total_videos = 0
    
    for split, num_samples in splits.items():
        print(f"\nGenerating {split} samples...")
        print("-" * 40)
        
        for action in actions:
            print(f"\n[{action.upper()}]")
            
            for i in range(1, num_samples + 1):
                output_path = OUTPUT_DIR / split / action / f"{action}_{i:03d}.mp4"
                
                # Create realistic sample video
                create_realistic_sample(output_path, action, i + hash(split) % 10)
                total_videos += 1
    
    print()
    print("=" * 60)
    print(f"Generation complete! Total videos: {total_videos}")
    print("=" * 60)
    print()
    print("Dataset structure:")
    print(f"  {OUTPUT_DIR}/")
    print(f"  +-- train/     ({len(actions) * splits['train']} videos)")
    print(f"  +-- val/       ({len(actions) * splits['val']} videos)")
    print(f"  +-- test/      ({len(actions) * splits['test']} videos)")
    print()
    print("All videos include RSK World branding!")
    print("Visit: https://rskworld.in")


def create_dataset_info():
    """Create dataset info JSON file"""
    info = {
        "_info": {
            "project": "Action Recognition Dataset",
            "website": "https://rskworld.in",
            "founder": "Molla Samser",
            "designer": "Rima Khatun",
            "contact": "help@rskworld.in",
            "phone": "+91 93305 39277",
            "copyright": "(c) 2026 RSK World. All Rights Reserved."
        },
        "dataset": {
            "name": "Action Recognition Sample Data",
            "version": "1.0.0",
            "description": "Real-looking action videos for demonstration",
            "generated_by": "download_real_videos.py"
        },
        "statistics": {
            "total_classes": 8,
            "train_samples": 24,
            "val_samples": 8,
            "test_samples": 8,
            "video_format": "MP4",
            "resolution": "640x480",
            "fps": 30,
            "duration_per_video": "4 seconds"
        },
        "classes": [
            {"id": 0, "name": "walking", "description": "Person walking"},
            {"id": 1, "name": "running", "description": "Person running"},
            {"id": 2, "name": "jumping", "description": "Person jumping"},
            {"id": 3, "name": "waving", "description": "Person waving hand"},
            {"id": 4, "name": "sitting", "description": "Person sitting down"},
            {"id": 5, "name": "standing", "description": "Person standing up"},
            {"id": 6, "name": "dancing", "description": "Person dancing"},
            {"id": 7, "name": "exercising", "description": "Person exercising"}
        ]
    }
    
    with open(OUTPUT_DIR / "dataset_info.json", "w") as f:
        json.dump(info, f, indent=4)
    
    print("[OK] Created dataset_info.json")


# ==================================================================================
# Entry Point
# ==================================================================================

if __name__ == "__main__":
    try:
        generate_all_samples()
        create_dataset_info()
        
        print()
        print("Thank you for using RSK World datasets!")
        print("For real video datasets, visit: https://rskworld.in")
        
    except KeyboardInterrupt:
        print("\n\nOperation cancelled by user.")
    except Exception as e:
        print(f"\nError: {e}")
        print("\nMake sure you have the required packages:")
        print("  pip install opencv-python numpy yt-dlp")
        print("\nContact: help@rskworld.in for support")
623 lines•21.1 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer