Skip to content

Handover & Delivery

Grace Xie edited this page Oct 23, 2025 · 34 revisions

1. Purpose

This handover document provides all materials, insights, and guidance necessary for clients and incoming teams to continue development, testing, and application of the In Situ Root Image Segmentation project.


2. Handover Package Contents

2.1 Client Notes

Overview of project objectives, scope, and key milestones achieved.

This semester, we worked on delivering 2 trained ONNX models based on the RPT Toolbox. As part of this process, we undertook Manual labelling of over 100+ images using various methods and provided the labelled images as a deliverable item. Additionally, we developed several manual labelling methods and also have provided documentation for all steps of the project, including how to train the models.

Summary of communications, client feedback, and decisions.

This can be found through the following:

Links to datasets, trained models, and documentation repositories.

2.2 Key Information for New Team Members

  • Summary of current progress and remaining tasks.

    Current Progress: We have successfully completed the new dataset labeling phase, ensuring higher-quality and more diverse annotations to improve model robustness. Based on the RPT (Root Phenotyping Toolbox) model, we have trained two versions of our root segmentation model, each designed to capture different structural and visual characteristics from the dataset. Preliminary evaluations show that both models perform well on the newly labeled samples, indicating a solid foundation for further improvement.

    Remaining Tasks: Our next steps will focus on two main areas:

    1. Expanding the Dataset: Continue labeling additional images to increase dataset size and diversity. This will help the model generalize better to unseen samples and reduce overfitting.

    2. Model Optimization and Retraining: Retrain and fine-tune the RPT-based models using the extended dataset. This includes adjusting hyperparameters, experimenting with augmentation techniques, and conducting quantitative evaluations to identify the best-performing configuration.

    Goal: The final goal is to achieve a more accurate, stable, and efficient segmentation model capable of handling various root image conditions across datasets.

  • Known technical dependencies and environment setup details.

  • Key contacts and roles (e.g., client liaison, lead researcher, technical advisor).

    Client Liaison:
    David
    Responsible for maintaining consistent communication with the client, organizing regular meetings, gathering feedback, and ensuring that all project deliverables align with the client’s expectations and overall goals.

    Lead Researcher:
    Yihui Sun
    Leads the overall research direction, including literature review, research methodology design, and evaluation of segmentation models based on the RPT framework. Oversees experiment planning, documentation, and analysis.

    Technical Lead / Machine Learning Engineer:
    Songshen Xie
    Responsible for implementing and optimizing the model architecture, training pipelines, and evaluation metrics using PyTorch. Handles debugging, code integration, and overall system performance enhancement.

    Data Annotation Coordinators:
    Grace, Yang Li, Yangyi Li, Cimeng Chen
    Manage the dataset labeling workflow and quality control. Coordinate the use of SegMATE and Photoshop to create high-quality binary masks and maintain consistency across datasets from multiple sources.

    Technical Advisor:
    Zhizhao Sun
    Provides technical guidance on model development, evaluation, and interpretation. Offers expert feedback on experiment design, system architecture, and research direction.

  • Access instructions for repositories, servers, and cloud resources.

2.3 Project SECRETS

  • Secure credentials, API keys, or environment variables required for operation.
  • Storage locations for sensitive or restricted data.
  • Versioning notes and configuration details for reproducibility.

3. User Guides

3.1 Labeling Tools

3.1.1 SegMATE

Overview, labeling workflow, and important notes.

  1. Drawing a Box
  • Hold Ctrl
  • Drag the mouse and release
  • (Optional) Hold Shift to add multiple boxes
  1. Clicking a Point
  • Hold Ctrl
  • Left-click for positive points
  • Right-click for negative points
  • (Optional) Hold Shift to add multiple points
  1. Drawing Multiple Boxes in a Region of Interest Automatically
  • Hold Alt
  • Drag the mouse to draw a loop enclosing the region of interest
  • Release the mouse
  1. Important Notes
  • Always switch on “split” mode for root segmentation.
    • To check if you are in split mode, press Ctrl + Space (this also toggles the prompt type between point and box).
  • Always export both the prompts and the mask when you finish.
    • The prompt file is essential if you want to modify the segmentation later.

3.1.2 Photoshop

Binary mask creation, layer management, and consistency tips.

  1. Open the raw image with Photoshop
  2. Create a new layer and focus on it (avoiding drawing on the raw image layer)
  3. Fill the new layer with pure black (rgb(0,0,0))
  4. Adjust the opacity of the new layer to 35%
  5. Use the Pencil tool to draw the roots with pure white (rgb(255,255,255))
  6. Export the new layer in PNG format

Useful shortcuts

  • Ctrl + Scroll wheel to scroll horizontally
  • Alt + Scroll wheel to zoom in or out
  • Ctrl + C to undo and Ctrl + Shift + C to redo

3.1.3 Songshen Method

Description of our preprocessing and labelling pipeline.

Step 1: Image Preprocessing

  • Go to https://liblib.art/sd and sign in or sign up using WeChat.
  • Scroll down and click ControlNet, then upload the original image.
  • Tick Enable, Perfect Pixel, and Allow Preview.
  • Under Control Type, select Lineart.
  • For Preprocessor, select Invert.
  • For Ending Control Step, set 1.
  • Click Run & Preview on the right side of the Preprocessor section.
  • Return to ControlNet and save the image from Preprocessor Preview (flip vertically if needed).
  • If you don’t use WeChat, use https://www.shakker.ai/sd, which achieves the same effect.

Step 2: Adjustments in Photoshop (PS)

  1. Open the preprocessed image in Photoshop. Press Ctrl+J to duplicate the layer, then hide Layer 0 (the original).
  2. Go to Image → Adjustments → Brightness/Contrast, set Contrast = 100.
  3. Open the Channels panel. Identify the channel with best contrast (e.g., Green), right-click it, and Duplicate Channel.
  4. With the duplicated channel selected: Ctrl+A (Select All), Ctrl+C (Copy). Switch back to Layers, Paste, and hide the original duplicate layer so you only work on the pasted channel copy.
  5. Go to Image → Adjustments → Levels:
    • Right slider ≈ 237
    • Left slider ≈ 55
    • Mid slider ≈ 0.85
    • Use Preview to check results.
  6. Go to Filter → Sharpen → Smart Sharpen. Set Radius ≈ 7.5 (range 5–10). Zoom in to inspect both thick and thin roots.
  7. Go to Filter → Other → High Pass. Set Radius ≈ 50 (range 40–60).
  8. Go to Image → Adjustments → Invert (roots become white).
  9. Go to Image → Adjustments → Threshold. Increase threshold (e.g., 162) while zoomed in to validate details.
  10. Compare with the original in another layer; tweak via History if needed.
  11. Save as PNG (no compression).

Step 3: Noise Filtering in Colab

  • Copy code from noiseRemover.ipynb (GitHub) into Google Colab.
  • Upload the PNG from the previous step.
  • Update the filename in code and set min_area ≈ 125.
  • Run to remove noise while preserving details.
  • Save the output as root_mask_filtered.png; optionally do a final clean-up in Photoshop.

Step 4: Updated Adjustments in Photoshop (PS) (Photopea) For similar adjustments without PS: https://www.photopea.com/

  • Select → Focus Area
  • Image → Adjustments → Desaturate
  • Filter → Sharpen → Smart Sharpen (Amount = 250, Radius = 3)
  • Image → Adjustments → Brightness/Contrast
  • Image → Adjustments → Levels
  • Image → Adjustments → Invert
  • Image → Adjustments → Threshold

3.1.4 Manual Drawing Tools

Based on the result from Songshen Method, Step 2, the mask is further refined as follows

Drawing using Photoshop and Huashijie Pro on Pad

Step 1: Create a distinguishable colour difference between the roots and the mask

  • Open the original image and the mask in the same document.
  • Place the original image on the lower layer and the mask on the upper layer.
  • Select the mask layer.
  • Go to Menu → Select → Color Range. Use the Eyedropper tool to click the white area and adjust Fuzziness until the white area is fully selected.
  • Confirm to get a marching ants selection (the white area is selected).
  • Create a new layer and fill it with red or blue (Shift+F5 → Use: Foreground Colour).
  • Deselect the selection (Ctrl+D).

Now the white mask becomes a colored mask (e.g., blue) for easier refinement.

Step 2: Add missing fine roots manually

  • Merge the blue mask and the original image into one layer and set the blue layer’s transparency to 50% so the roots are visible.
  • Add the missing fine roots by hand-drawing blue lines using the Huashijie Pro app on an Android pad.
  • Save the refined blue mask and use Photoshop to resize it back to 3456×5184 to avoid mismatch problems.
  • Use the script convert_colored_mask_to_binary.ipynb to convert the blue mask back into a binary mask. This completes the refinement.

Step 3: Confirm the labelling result

  • Open the final binary mask in SegMATE to verify that all roots are detected and no unwanted regions are included.
  • If unwanted strokes are present, open the mask in Photoshop, set the pen color to black, and draw over the unwanted areas to remove them.

3.1.5 GIMP

Here is steps of using Gimp to visualize your segmentation results (segmentation quality check), Very Very simple, detailed steps:  

  1. File → Open original RGB image
  2. File → "Open as layers" and select the binary mask image
  3. Click “Select” → “By color”, click the white area (roots) in the mask image
  4. Click “Edit” → File with FG (Foreground) color (e.g., blue), you need to set the foreground color beforehand
  5. Ctrl + C (copy)
  6. Ctrl + V (paste), a new layer will be created on the top with the roots in foreground color, you can change the transparency of this layer to semi-transparent
  7. Remove the mask layer below
  8. Click “Select (menu)” → None, now you should see the original RGB image with the roots enhanced in foreground color

3.1.6 Unified Labeling Workflow (General Method)

This end-to-end method combines ControlNet preprocessing → code-based noise reduction → tablet/PS manual touch-up → temporary coloured-mask comparison → SegMATE/GIMP final QA. It is robust for dense/complex in-situ root images.

Inputs

  • Original RGB image(s)

Outputs

  • Final binary mask(s) (white = root, black = background), PNG format
  • (Optional) Prompt files from SegMATE for later edits
Step 0: Project Setup & Conventions
  • Folder layout
  • Naming: keep base names consistent, e.g., IMG_0001.jpg → IMG_0001_mask.png.
  • Bit depth: keep masks as 8-bit PNG.
  • Colour space: sRGB for images; binary masks strictly 0 or 255.
Step 1: ControlNet Preprocessing (Lineart extraction)

Option A (WeChat users): https://liblib.art/sd → ControlNet

  1. Tick Enable, Perfect Pixel, Allow Preview.
  2. Control Type: Lineart.
  3. Preprocessor: Invert.
  4. Ending Control Step: 1.
  5. Run & Preview, then save the Preprocessor Preview image (flip vertically if needed).

Option B (No WeChat): https://www.shakker.ai/sd with equivalent ControlNet settings.

Result: a high-contrast “lineart-like” image (masks_raw/IMG_0001_lineart.png) to boost root–soil separability.

Step 2: Photoshop (or Photopea) Contrast Shaping → Initial Binary

Aim: push roots toward white, background toward black, without losing fine details.

In Photoshop:

  1. Open the preprocessed image → Ctrl+J to duplicate; hide the original.
  2. Image → Adjustments → Brightness/Contrast → set Contrast = 100.
  3. Channels: identify the best-contrast channel (often Green); right-click → Duplicate Channel.
  • Ctrl+A, Ctrl+C, switch back to Layers, Paste.
  1. Image → Adjustments → Levels (typical starting values):
  • Left (black) ≈ 55, Mid ≈ 0.85, Right (white) ≈ 237
  1. Filter → Sharpen → Smart Sharpen (Radius ≈ 5–10, try 7.5).
  2. Filter → Other → High Pass (Radius ≈ 40–60, try 50).
  3. Image → Adjustments → Invert (roots become white).
  4. Image → Adjustments → Threshold (start around 162, adjust while zoomed in).
  5. Export as PNG → masks_raw/IMG_0001_thresh.png.

In Photopea (browser alternative):

  • Use: Select → Focus Area, Desaturate, Smart Sharpen (Amount 250, Radius 3), Brightness/Contrast, Levels, Invert, Threshold.
Step 3: Code-Based Noise Reduction (Colab)

Use your noiseRemover.ipynb to remove small speckles while preserving fine roots.

  1. Upload masks_raw/IMG_0001_thresh.png.
  2. Set a minimum component area (start with min_area ≈ 125; adjust per dataset).
  3. Run the notebook to produce:
  • masks_filtered/IMG_0001_mask_filtered.png

Tip: If thin roots get eroded, lower min_area slightly; if noise persists, increase it gradually.

Step 4: Manual Refinement (Tablet/PS)

Aim: restore missed fine roots and remove residual artifacts, with high precision.

Make the mask easy to see while editing:

  1. Open original RGB and filtered mask in one PS document.
  2. Ensure mask layer is selected:
  • Select → Color Range → click white mask → adjust Fuzziness until all mask is selected.
  • Shift+F5 → Fill selection with a strong colour (e.g., blue).
  1. Set the coloured mask layer’s Opacity ≈ 50% above the RGB image.

Manual touch-up (e.g., Huashijie Pro on tablet or PS Pencil):

  • Trace missing fine roots with the coloured stroke.
  • Erase false positives (non-root strokes).
  • Keep zooming to validate thin structures.
  • When done, resize back to the original resolution (e.g., 3456×5184) to prevent mismatch.

Convert coloured mask back to binary:

  • Use your convert_colored_mask_to_binary.ipynb (or simple PS threshold) to produce
    masks_final/IMG_0001_mask.png (white roots on black background).
Step 5: Final Quality Assurance (SegMATE / GIMP)

SegMATE check

  • Load masks_final/IMG_0001_mask.png with the original image.
  • Verify full root coverage and absence of spurious regions.
  • If using SegMATE prompts, export both mask and prompts for future edits.

GIMP overlay (quick visual QA)

  1. File → Open original RGB.
  2. File → Open as layers → select final mask.
  3. Select → By Color on the white mask → Edit → Fill with FG (e.g., blue).
  4. Copy → Paste (new top layer); adjust transparency to semi-transparent.
  5. Remove the old mask layer; Select → None.
  6. Save overlay to overlays/IMG_0001_overlay.png for records.
Step 6: Packaging & Handover
  • Binary masks: masks_final/*.png (8-bit, white roots, black background).
  • Overlays: overlays/*.png (for reviewers/users to quickly assess quality).
  • Prompts (optional): prompts/*.json from SegMATE to allow iterative edits.
  • README in the dataset folder:
  • Tool versions (SegMATE build, PS/Photopea date), key thresholds, min_area, and any deviations.
Quick Tips & Pitfalls
  • Always keep a non-destructive workflow (work on duplicates, keep originals).
  • Verify resolution before saving final masks to avoid training-time mismatches.
  • If ControlNet output is flipped, fix orientation immediately to avoid later confusion.
  • Thin-root preservation depends on Levels/Threshold tuning (Step 2) and min_area (Step 3).
    Iterate lightly—small changes can have large effects.
  • Keep an example gallery (3–5 overlays) to calibrate team acceptance criteria.
Keyboard Shortcuts (PS)
  • Ctrl + Scroll = horizontal scroll
  • Alt + Scroll = zoom in/out
  • Ctrl + Z / Ctrl + Shift + Z = undo/redo

3.2 Model User Guide (RPT)

_The following details the overview of the Root Phenotyping Toolbox (RPT) setup and configuration. It will detail the Model structure and dependencies (UNet + CBAM + subpixel convolution), and provide instructions to train, test, and evaluate the model. _

3.2.1 Preparing the Dataset

  • Place the original images and masks into the two designated folders (they must match as shown in the reference example).
  • Ensure that the image filenames and mask filenames are the same.
image
  • Run check_dataset_en.py to validate the dataset.
    • If all data formats are correct, you will see a confirmation message.
image

3.2.2 Training

  • Open the GUI and switch to the training interface.
  • Note: Only GPU training is supported.
  • Choose appropriate parameters.
  • Start training.
image

3.2.3 Output

  • The training produces a file in .pdparams format.
  • This output file can be used directly for prediction.
image

3.2.4 Result

Example result screenshot
image image

3.2.5 ONNX Conversion


4. Project Risks

  • Technical Risks: Environment mismatch, GPU dependency.
  • Data Quality Risks: Inconsistent labelling, soil noise interference.
  • Continuity Risks: Knowledge transfer gaps, incomplete documentation.

Mitigation Recommendations:
Document setup steps, maintain dataset versioning, and validate model checkpoints regularly.

Complete list of risks can be found in our risk register here: Risk Register


5. Project Backlog


6. Project Advice


7. Appendices

  • Shi J, Xie S, Li W, Wang X, Wang J, Chen Y, Chang Y, Lou Q, Yang W. RPT: An integrated root phenotyping toolbox for segmenting and quantifying root system architecture. Plant Biotechnol J. 2025 Jun;23(6):2095-2109. doi: 10.1111/pbi.70040. Epub 2025 Mar 12. PMID: 40074292; PMCID: PMC12120892.

Clone this wiki locally