|
| 1 | +--- |
| 2 | +title: "GSoC '25 Week 16 Update by Aditya Kumar Singh" |
| 3 | +excerpt: "Advanced shared mode with global vs local moves, extended PoseNet-based video import with MobileNet/ResNet, template palette with event-driven design, and multiple UX refinements." |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-08-30" |
| 6 | +slug: "2025-08-30-gsoc-25-AdityaKrSingh26-week16" |
| 7 | +author: "@/constants/MarkdownFiles/authors/aditya-singh.md" |
| 8 | +tags: "gsoc25,sugarlabs,week16,AdityaKrSingh26" |
| 9 | +image: "assets/Images/GSOC.webp" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 16 Progress Report by Aditya Kumar Singh |
| 15 | + |
| 16 | +**Project:** [Sugarizer](https://github.com/llaske/sugarizer) |
| 17 | +**Mentors:** [Lionel Laské](https://github.com/llaske) |
| 18 | +**Assisting Mentors:** [Samarth Bagga](https://github.com/SamarthBagga) |
| 19 | +**Reporting Period:** 2025-08-25 - 2025-09-01 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goals for This Week |
| 24 | + |
| 25 | +- **Goal 1:** Improve shared mode implementation with fine-grained move handling. |
| 26 | +- **Goal 2:** Extend AI-based video import feature with multiple PoseNet backbones and UX polish. |
| 27 | +- **Goal 3:** Build a reusable template palette for stickman animations. |
| 28 | +- **Goal 4:** Address UI inconsistencies and quality-of-life fixes. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | + |
| 33 | +## This Week’s Achievements |
| 34 | + |
| 35 | +1. **Shared Mode Enhancements** |
| 36 | + - In earlier weeks, shared mode already supported ownership markers and drag/drop of remote stickmen. This week’s focus was on movement semantics and ensuring consistency across animations: |
| 37 | + - **Relative Position Preservation During Animation** |
| 38 | + - Each stickman maintains both its original joints (from remote updates) and a local offset (applied when dragged). During animations, incoming updates refresh the joints but do not overwrite local offsets, so remote stickmen appear stable in the scene. |
| 39 | + ```js |
| 40 | + function applyOffset(stickman, frame) { |
| 41 | + const base = stickman.originalFrames[frame]; |
| 42 | + const offset = stickman.localOffsets[frame] || { x: 0, y: 0 }; |
| 43 | + return base.map(joint => ({ |
| 44 | + x: joint.x + offset.x, |
| 45 | + y: joint.y + offset.y |
| 46 | + })); |
| 47 | + } |
| 48 | + ``` |
| 49 | + - **Global vs Local Moves** |
| 50 | + - Moves performed on frame 0 (the initial frame) are tagged as global and applied across all frames. |
| 51 | + - Moves on later frames are local and affect only that frame’s playback. |
| 52 | + - This required maintaining a globalOffset in the stickman object and a localOffsets dictionary keyed by frame index. |
| 53 | + |
| 54 | + - **Tutorial Updates**: The help/tutorial system was updated to explain new behavior and color-coding: |
| 55 | + - Black Head → local stickman. |
| 56 | + - Red dots → active/selected stickman. |
| 57 | + - Yellow dot at waist → For dragging stickman across screen. |
| 58 | + - Colored Head → remote stickman (color corresponds to the user). |
| 59 | + |
| 60 | +2. **Video Import Improvements (PoseNet → Stickman)** |
| 61 | + - This task built on last week’s AI integration, moving from a working prototype into a more robust import pipeline: |
| 62 | + - **Debugging with Hardcoded PoseNet Samples**: Extracted sample keypoints directly from PoseNet output to manually verify joint mappings. This surfaced alignment issues between PoseNet’s 17-keypoint skeleton and Stickman’s simpler joint hierarchy. |
| 63 | + - **Support for Multiple Backbones**: Added flexibility to run PoseNet with two different architectures: |
| 64 | + - MobileNetV1 (~4.2M params) → optimized for performance on low-power devices. |
| 65 | + - ResNet50 (~25M params) → slower but higher accuracy, especially useful for complex movements. |
| 66 | + - **Joint Distance Enforcement**: A recurring issue was unnatural limb proportions when mapping PoseNet joints. To solve this, I used the `enforceJointDistances()` method from `activity.js`: |
| 67 | + ```js |
| 68 | + jointConnections.forEach(([a, b, expectedDist]) => { |
| 69 | + const actual = distance(joints[a], joints[b]); |
| 70 | + if (Math.abs(actual - expectedDist) > tolerance) { |
| 71 | + adjustJoint(joints, a, b, expectedDist); |
| 72 | + } |
| 73 | + }); |
| 74 | + ``` |
| 75 | + - This keeps the stickman body consistent regardless of PoseNet noise. |
| 76 | + - **Frame Deduplication**: Implemented logic to skip saving consecutive identical frames, which reduced output clutter and produced smoother animations. |
| 77 | + - **UI/UX Enhancements in Import Dialog**: |
| 78 | + - Loading spinner during TensorFlow.js model initialization. |
| 79 | + - Autoplay of input video with a green pose overlay (restored for clarity). |
| 80 | + - Simplified controls (only Cancel + Insert). |
| 81 | + - Neat display of current frame index. |
| 82 | + - Fixed delete-frame bug → selection now stays on previous frame, not reset to first. |
| 83 | + - Randomized imported stickman positions to avoid overlap when multiple stickmen are added. |
| 84 | + |
| 85 | + |
| 86 | +3. **Template Palette Feature** |
| 87 | + - I introduced a Template Palette, enabling quick insertion of prebuilt animations into the workspace. |
| 88 | + - **Implementation (templatepalette.js)**: Using Sugar’s palette system, I created a palette with buttons (run, boxing, dance1, dance2). Each button dispatches a template-selected event: |
| 89 | + ```js |
| 90 | + runButton.addEventListener("click", () => { |
| 91 | + document.dispatchEvent(new CustomEvent('template-selected', { |
| 92 | + detail: { template: 'run' } |
| 93 | + })); |
| 94 | + setActiveButton(runButton); |
| 95 | + self.popDown(); |
| 96 | + }); |
| 97 | + ``` |
| 98 | + - **Preloaded Templates**: Templates were generated from exported animations and stored as JSON. These JSONs are loaded at startup, making templates instantly available. |
| 99 | + - **UI Design**: Each template button shows a name and animated preview, helping users recognize the animation before inserting it. This also makes the feature accessible for younger students with limited reading skills. |
| 100 | + > Template Preview |
| 101 | +  |
| 102 | + |
| 103 | + |
| 104 | +4. **Minor Improvements & Bug Fixes** |
| 105 | + - Fixed palette color persistence and closing behavior. |
| 106 | + - Ensured imported palette stickmen are also shared in collaborative mode. |
| 107 | + - Applied Sugar UI look-and-feel to buttons (rounded corners, consistent style). |
| 108 | + - Restored the green pose overlay in PoseNet video preview. |
| 109 | + - Added spinner + disabled UI during first TensorFlow.js library load. |
| 110 | + - Multiple incremental bug fixes merged into PR, improving stability for both single-user and shared sessions. |
| 111 | + > UI Changes |
| 112 | +  |
| 113 | + |
| 114 | +## Challenges & Solutions |
| 115 | + |
| 116 | +- **Challenge:** Explaining and implementing global vs local moves. |
| 117 | + **Solution:** Designed clear frame-based rules (frame 0 = global, others = local) and updated tutorials with color-coded indicators. |
| 118 | + |
| 119 | +- **Challenge:** Building an extensible template system. |
| 120 | + **Solution:** Used CustomEvent('template-selected') so templates are decoupled from activity logic. This makes it easy to add more templates later without touching core code. |
| 121 | + |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Acknowledgments |
| 126 | + |
| 127 | +Thank you to my mentors, the Sugar Labs community, and fellow GSoC contributors for ongoing support. |
| 128 | + |
| 129 | +--- |
0 commit comments