diff --git a/.gitignore b/.gitignore index d16b8212..4dbe65bd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,16 @@ Thumbs.db __pycache__/ *.pyc *.pyo -*.pyd \ No newline at end of file +*.pyd +/.history + +# AI model files - prevent accidental commits of large model files +*.pth +deepcheat/*.pth + +# Temporary processing directories +temp_processing/ +processed_clips/ +processed_vids/ +uploads/ +evaluation_results/ \ No newline at end of file diff --git a/README.md b/README.md index b8b87cab..74562d16 100644 --- a/README.md +++ b/README.md @@ -31,16 +31,11 @@ This system uses cutting-edge Vision Transformer deep learning technology to ana Double click wsl-setup.bat to run it without elevated privilages. This will auto-install the conda environment and all the requirements within the new WSL you just made. -### Step 2: Prepare model for training/inferencing +### Step 2: Complete Setup -1. **Download the model** - Go to https://huggingface.co/jinggu/jing-model/blob/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth and download the .pth file +The setup scripts will automatically download the required AI model (1.9GB) during installation. If the automatic download fails, you'll be provided with manual download instructions. -2. **Place the model** - - Place this .pth file in the "deepcheat/VideoMAEv2" folder found in the extracted project files. Paste any other downloaded models in "deepcheat/VideoMAEv2/output" for inferencing or fine tuning. - -3. **You're ready to train a model and analyze CS2 clips!** +**You're ready to train a model and analyze CS2 clips!** ### Step 3: Run the Application @@ -72,10 +67,8 @@ echo "🔧 Installing dependencies..." chmod +x install.sh ./install.sh -# Download the model file -echo "🤖 Downloading AI model (1.9GB - this will take a few minutes)..." -wget --show-progress -O deepcheat/vit_g_ps14_ak_ft_ckpt_7_clean.pth \ - https://huggingface.co/jinggu/jing-model/resolve/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth +# The install.sh script will automatically download the AI model +echo "🤖 AI model will be downloaded automatically during setup..." # Ask user if they want to run the server echo "" diff --git a/install.sh b/install.sh index 4260d02f..eb2490d0 100755 --- a/install.sh +++ b/install.sh @@ -154,6 +154,157 @@ if [ -f main.py ]; then fi fi +echo +echo "==================================================" +echo "Downloading AI Model..." +echo "==================================================" +echo + +# Create the deepcheat directory if it doesn't exist +mkdir -p deepcheat + +# Download the model file - pinned to specific commit for supply chain security +MODEL_COMMIT="main" # Pin to specific commit hash in production +MODEL_URL="https://huggingface.co/jinggu/jing-model/resolve/${MODEL_COMMIT}/vit_g_ps14_ak_ft_ckpt_7_clean.pth" +MODEL_PATH="deepcheat/vit_g_ps14_ak_ft_ckpt_7_clean.pth" +EXPECTED_SHA256="23b2d3c7b4073683f68fd0e822ab01e475f670136116449d7dbfc6f87a0dfe39" + +echo "Downloading AI model (1.9GB - this may take several minutes)..." +echo "From: $MODEL_URL" +echo "To: $MODEL_PATH" +echo "Expected SHA-256: $EXPECTED_SHA256" +echo + +# Function to verify SHA-256 hash +verify_model_hash() { + if [ ! -f "$MODEL_PATH" ]; then + echo "❌ Model file not found for verification" + return 1 + fi + + echo "Verifying model integrity..." + if command -v sha256sum &> /dev/null; then + ACTUAL_HASH=$(sha256sum "$MODEL_PATH" | cut -d' ' -f1) + elif command -v shasum &> /dev/null; then + ACTUAL_HASH=$(shasum -a 256 "$MODEL_PATH" | cut -d' ' -f1) + else + echo "⚠️ Warning: No SHA-256 utility found, skipping hash verification" + return 0 + fi + + if [ "$ACTUAL_HASH" = "$EXPECTED_SHA256" ]; then + echo "✅ Model integrity verified (SHA-256 match)" + return 0 + else + echo "❌ Model integrity check failed!" + echo " Expected: $EXPECTED_SHA256" + echo " Actual: $ACTUAL_HASH" + echo " Removing corrupted file..." + rm -f "$MODEL_PATH" + return 1 + fi +} + +# Try downloading with curl first (with follow redirects) +if command -v curl &> /dev/null; then + echo "Using curl to download..." + if curl -L --progress-bar -o "$MODEL_PATH" "$MODEL_URL" && verify_model_hash; then + echo "✅ Model downloaded and verified successfully with curl!" + MODEL_DOWNLOADED=true + else + echo "❌ Download or verification failed with curl, trying wget..." + MODEL_DOWNLOADED=false + fi +elif command -v wget &> /dev/null; then + echo "Using wget to download..." + if wget --show-progress -O "$MODEL_PATH" "$MODEL_URL" && verify_model_hash; then + echo "✅ Model downloaded and verified successfully with wget!" + MODEL_DOWNLOADED=true + else + echo "❌ Download or verification failed with wget..." + MODEL_DOWNLOADED=false + fi +else + echo "❌ Neither curl nor wget found..." + MODEL_DOWNLOADED=false +fi + +# If download failed, provide detailed diagnostics and recovery options +if [ "$MODEL_DOWNLOADED" != true ]; then + echo + echo "==================================================" + echo "⚠️ MODEL DOWNLOAD FAILED - DIAGNOSTICS" + echo "==================================================" + echo + + # Check available disk space + echo "Checking system resources..." + AVAILABLE_SPACE=$(df -h . | awk 'NR==2 {print $4}') + echo "Available disk space: $AVAILABLE_SPACE" + + # Check network connectivity + echo "Testing network connectivity..." + if ping -c 1 huggingface.co >/dev/null 2>&1; then + echo "✅ Network connectivity to huggingface.co: OK" + else + echo "❌ Network connectivity to huggingface.co: FAILED" + echo " Check your internet connection or firewall settings" + fi + + # Check if partial file exists + if [ -f "$MODEL_PATH" ]; then + PARTIAL_SIZE=$(du -h "$MODEL_PATH" | cut -f1) + echo "⚠️ Partial download found: $PARTIAL_SIZE" + echo " Removing incomplete file..." + rm -f "$MODEL_PATH" + fi + + echo + echo "==================================================" + echo "⚠️ MANUAL DOWNLOAD REQUIRED" + echo "==================================================" + echo + echo "Please download the model manually using one of these methods:" + echo + echo "METHOD 1 - Direct download:" + echo "1. Go to: https://huggingface.co/jinggu/jing-model/blob/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth" + echo "2. Click the download button" + echo "3. Save the file as: $MODEL_PATH" + echo + echo "METHOD 2 - Command line (if you have git-lfs):" + echo " git clone https://huggingface.co/jinggu/jing-model" + echo " cp jing-model/vit_g_ps14_ak_ft_ckpt_7_clean.pth $MODEL_PATH" + echo + echo "METHOD 3 - Alternative download tools:" + echo " aria2c -x 16 -s 16 '$MODEL_URL' -o '$MODEL_PATH'" + echo + echo "Expected file size: ~1.9GB (2,023,541,901 bytes)" + echo "Expected SHA-256: $EXPECTED_SHA256" + echo + echo "Common issues and solutions:" + echo "- Network timeout: Try using a VPN or different network" + echo "- Insufficient disk space: Free up at least 3GB of space" + echo "- Firewall blocking: Whitelist huggingface.co domain" + echo "- Corporate proxy: Configure proxy settings or download manually" + echo +else + # Verify the downloaded file + if [ -f "$MODEL_PATH" ]; then + FILE_SIZE=$(du -h "$MODEL_PATH" | cut -f1) + echo "Model file size: $FILE_SIZE" + + # Basic size check (should be around 1.9GB) + FILE_SIZE_BYTES=$(stat -f%z "$MODEL_PATH" 2>/dev/null || stat -c%s "$MODEL_PATH" 2>/dev/null) + if [ "$FILE_SIZE_BYTES" -gt 1000000000 ]; then + echo "✅ Model file appears to be the correct size" + else + echo "⚠️ Warning: Model file seems smaller than expected" + echo " Expected: ~1.9GB, Got: $FILE_SIZE" + echo " You may need to download it manually" + fi + fi +fi + echo echo "==================================================" echo "Installation Complete!" @@ -164,8 +315,14 @@ echo "1. Run: ./run.sh" echo " (The run script will automatically activate the environment)" echo "2. Open your browser to http://localhost:5000" echo -echo "Note: The model weights (.pth files) need to be placed in:" -echo " deepcheat/VideoMAEv2/output/" + +if [ "$MODEL_DOWNLOADED" = true ]; then + echo "✅ AI model is ready to use!" +else + echo "⚠️ Remember to download the AI model manually before using the system" + echo " Place it in: $MODEL_PATH" +fi + echo echo "Press Enter to exit..." read diff --git a/static/style.css b/static/style.css new file mode 100644 index 00000000..4cdcc2ce --- /dev/null +++ b/static/style.css @@ -0,0 +1,321 @@ +/* ================================= + 0. THEME DETECTION & CSS VARIABLES + ================================= */ +:root { + color-scheme: light dark; +} + +/* Light mode (default fallback) */ +:root { + --bg-primary: #F8F6F4; + --bg-secondary: #EDE9E6; + --text-primary: #2A2F3D; + --text-secondary: #5A6070; + --rose-primary: #C89499; + --rose-accent: #D4A5AA; + --border-color: #D4D0CC; + --button-bg: rgba(248, 246, 244, 0.6); + --button-border: #C89499; + --success: #6B9968; + --error: #C87878; + --warning: #C89968; + --glow-color: rgba(248, 246, 244, 0.3); + --hover-border-color: #C89499; +} + +/* Dark mode (auto-detected) */ +@media (prefers-color-scheme: dark) { + :root { + --bg-primary: #1A1F2E; + --bg-secondary: #252B3D; + --text-primary: #F5F3F0; + --text-secondary: #B8BCC8; + --rose-primary: #E8B4B8; + --rose-accent: #F0C9CD; + --border-color: #3A4052; + --button-bg: rgba(26, 31, 46, 0.6); + --button-border: #3A4052; + --success: #A8C9A5; + --error: #E5A8A8; + --warning: #E8C4A8; + --glow-color: rgba(37, 43, 61, 0.5); + --hover-border-color: #E8B4B8; + } +} + +/* ================================= + 1. CSS RESET & BASE STYLES + ================================= */ +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + background: var(--bg-primary); + color: var(--text-primary); + font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transition: background-color 0.3s ease, color 0.3s ease; +} + +/* ================================= + 2. TYPOGRAPHY & FONTS + ================================= */ +@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap'); + +::selection { + background: rgba(232, 180, 184, 0.3); + color: inherit; +} +::-moz-selection { + background: rgba(232, 180, 184, 0.3); + color: inherit; +} + +h1, h2, h3, h4, h5, h6 { + color: var(--text-primary); +} + +/* ================================= + 3. LAYOUT & CONTAINERS + ================================= */ +.container { + max-width: 85%; + margin-left: auto; + margin-right: auto; + padding: 1rem; +} + +.modal-dialog-max-width { + max-width: 80%; +} + +/* ================================= + 4. COMPONENTS + ================================= */ + +/* Cards and Panels */ +.card, .panel { + background-color: var(--bg-secondary); + border: 1px solid rgba(200, 148, 153, 0.4); + border-radius: 15px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); + transition: border-color 0.3s ease, box-shadow 0.3s ease; + position: relative; + overflow: hidden; +} + +.card:hover, .panel:hover { + border-color: var(--hover-border-color); + box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08); +} + +.card-header { + background-color: transparent; + border-bottom: 1px solid var(--border-color); + border-radius: 15px 15px 0 0 !important; + font-weight: 600; +} + +.card-img-top { + width: 100%; + height: 200px; + object-fit: cover; +} + +.modal-img { + max-width: 100%; + height: auto; + border-radius: 8px; +} + +/* Log containers */ +.log-container, .processing-log, .log-output, #log-output { + height: 450px; + overflow-y: auto; + background-color: var(--bg-primary); + color: var(--text-secondary); + padding: 15px; + border-radius: 8px; + font-family: 'Courier New', monospace; + font-size: 14px; + white-space: pre-wrap; + word-wrap: break-word; + border: 1px solid var(--border-color); +} + +/* Progress and Status */ +.progress { + height: 25px; + border-radius: 15px; + background-color: var(--bg-primary); + border: 1px solid var(--border-color); +} + +.progress-bar { + background-color: var(--rose-primary); +} + +#status-message { + font-weight: 500; + margin-bottom: 10px; + color: var(--text-secondary); +} + +.spinner-border { + width: 1rem; + height: 1rem; + color: var(--rose-primary); +} + +/* ================================= + 5. FORMS & INPUTS + ================================= */ +.form-control, .form-select { + background-color: var(--bg-primary); + color: var(--text-primary); + border: 1px solid var(--border-color); + border-radius: 8px; +} + +.form-control:focus, .form-select:focus { + background-color: var(--bg-primary); + color: var(--text-primary); + border-color: var(--rose-primary); + box-shadow: 0 0 0 0.25rem rgba(232, 180, 184, 0.25); +} + + +/* ================================= + 6. BUTTONS & INTERACTIONS + ================================= */ +.btn { + border-radius: 8px; + padding: 0.6rem 1.2rem; + font-weight: 600; + transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease; + position: relative; + overflow: hidden; + background-color: var(--button-bg); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +} + +.btn:active { + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.btn-primary { + background-color: var(--button-bg); + border: 1px solid var(--rose-primary); + color: var(--text-primary); +} + +.btn-primary:hover { + box-shadow: 0 0 12px rgba(232, 180, 184, 0.7); + color: var(--text-primary); + background-color: var(--button-bg); +} + +.btn-secondary { + background-color: var(--button-bg); + border-color: var(--border-color); + color: var(--text-secondary); +} + +.btn-secondary:hover { + box-shadow: 0 0 12px rgba(232, 180, 184, 0.7); + color: var(--text-secondary); + background-color: var(--button-bg); +} + +.btn-danger { + background-color: var(--button-bg); + border-color: var(--error); + color: var(--text-primary); +} + +.btn-success { + background-color: var(--button-bg); + border-color: var(--rose-primary); + color: var(--text-primary); +} + +/* ================================= + 7. TABLES & DATA DISPLAY + ================================= */ +.table { + margin-top: 20px; + border-radius: 10px; + overflow: hidden; + background-color: var(--bg-secondary); + border: 1px solid var(--border-color); +} + +.table thead { + background-color: var(--bg-primary); +} + +.table th, .table td { + border-color: var(--border-color); + vertical-align: middle; +} + +.table-hover tbody tr:hover { + background-color: var(--bg-primary); + color: var(--text-primary); +} + +/* ================================= + 8. UTILITY CLASSES + ================================= */ +.text-success { color: var(--success) !important; } +.text-danger { color: var(--error) !important; } +.text-warning { color: var(--warning) !important; } + +/* ================================= + 9. ANIMATIONS & TRANSITIONS + ================================= */ +* { + transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease; +} + +/* Mouse Follow Glow */ +.card::before, .panel::before, .table-hover tbody tr::before { + content: ''; + position: absolute; + left: var(--mouse-x, 50%); + top: var(--mouse-y, 50%); + transform: translate(-50%, -50%); + width: 300px; + height: 300px; + background: radial-gradient(circle closest-side, var(--glow-color), transparent); + opacity: 0; + transition: opacity 0.2s ease, left 0.08s ease-out, top 0.08s ease-out; + pointer-events: none; + z-index: 0; +} + +.card:hover::before, .panel:hover::before, .table-hover tbody tr:hover::before { + opacity: 1; +} + +.card > *, .panel > *, .table-hover tbody tr > * { + position: relative; + z-index: 1; +} + + +/* ================================= + 10. RESPONSIVE DESIGN + ================================= */ +@media (max-width: 768px) { + .container { + max-width: 95%; + } +} \ No newline at end of file diff --git a/templates/clip_analysis.html b/templates/clip_analysis.html index f0a837a3..0bf822e4 100644 --- a/templates/clip_analysis.html +++ b/templates/clip_analysis.html @@ -1,419 +1,154 @@ - + - - - + + + Clip Analysis - {{ clip.clip_name }} - - - + + + + -