CropCode inference models, samples and code
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- LICENSEAdded+202
- README.mdAdded+115
- SHA256SUMSAdded+168
- cropcode_model/embodied_mae.pyAdded+870
- cropcode_model/embodied_mae_4m.pyAdded+1191
- cropcode_model/embodied_mae_4m_maize.pyAdded+385
- cropcode_model/pc_sinkhorn.pyAdded+55
- inference.pyAdded+130
- models/maize-field/config.jsonAdded+616
- models/maize-field/model.safetensorsAdded+3
- models/maize-generalist/config.jsonAdded+89
- models/maize-generalist/model.safetensorsAdded+3
- models/maize-row/config.jsonAdded+556
- models/maize-row/model.safetensorsAdded+3
- models/sorghum-field/config.jsonAdded+123
- models/sorghum-field/model.safetensorsAdded+3
- models/sorghum-generalist/config.jsonAdded+62
- models/sorghum-generalist/model.safetensorsAdded+3
- models/sorghum-row/config.jsonAdded+61
- models/sorghum-row/model.safetensorsAdded+3
- requirements.txtAdded+3
- samples/maize/field_0204_row0936_stop06/input_rgb.pngAdded
- samples/maize/field_0204_row0936_stop06/inputs.npzAdded+3
- samples/maize/field_0204_row0936_stop06/preview.pngAdded
- samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.csvAdded+94
- samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.pcdAdded+3
- samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.pngAdded
- samples/maize/field_0204_row0936_stop06/reference/maize-field__all/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-field__all/recipe.jsonAdded+115
- samples/maize/field_0204_row0936_stop06/reference/maize-field__all/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/recipe.jsonAdded+97
- samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/recipe.jsonAdded+124
- samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/recipe.jsonAdded+97
- samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-row__all/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-row__all/recipe.jsonAdded+124
- samples/maize/field_0204_row0936_stop06/reference/maize-row__all/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/recipe.jsonAdded+79
- samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/recipe.jsonAdded+160
- samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/summary.jsonAdded+11
- samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/pred_cloud.plyAdded+3
- samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/recipe.jsonAdded+79
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115---license: apache-2.0library_name: pytorchtags:- plant-phenotyping- point-cloud- 3d-reconstruction- multimodal- masked-autoencoder- agriculture---
# CropCode: inference models
Models from the CropCode paper for sorghum and maize. Each model reads a photograph, a depth image and a pointcloud of a plant (any one of them is enough) and writes the plant's point cloud and its procedural parameters:plant height, leaf count and one record per leaf. This repository holds the six models meant for use, sampleinputs for each, and a short script that runs them. Training and evaluation code is in the code repository.
## Models
| model | species | what it does | epoch ||---|---|---|---|| `sorghum-generalist` | sorghum | Single plant: any one stream (photo, depth or point cloud) in, the plant cloud and its procedural parameters out (Stage 2, distilled generalist) | 100 || `sorghum-row` | sorghum | Crop rows: the centre plant reconstructed from a view of the whole row, neighbours included (Stage 3, row fine-tune) | 100 || `sorghum-field` | sorghum | Field rows of real plants: the row model fine-tuned on field data; also writes the leaf count | 26 || `maize-generalist` | maize | Single plant: any one stream (photo, depth or point cloud) in, the plant cloud and its procedural parameters out (Stage 2, distilled generalist) | 100 || `maize-row` | maize | Crop rows: the centre plant reconstructed from a view of the whole row, neighbours included (Stage 3, row fine-tune) | 100 || `maize-field` | maize | Field rows of real plants: the row model fine-tuned on field data | 26 |
All models are ViT-Base (114 M parameters, fp32 safetensors, 457 MB each). The `-generalist` models work on asingle isolated plant. The `-row` models reconstruct the centre plant of a crop row with its neighbours in view.The `-field` models are the row models fine-tuned on field rows of real plants.
## Quick start
```bashpip install -r requirements.txtpython inference.py --listpython inference.py --model sorghum-generalist --sample samples/sorghum/plant_Sorghum_10756 --source rgbpython inference.py --model maize-field --sample samples/maize/field_0204_row0936_stop06```
`--source all` shows the model every stream at the masked ratio it was trained with; `--source rgb`, `depth` or`pc` gives it that stream alone. The script writes `pred_cloud.ply` (metres, centred like the input cloud),`recipe.json` (the procedural parameters) and `summary.json` (Chamfer distance, height and leaf count against thetruth when the sample has it).
## Samples
One isolated plant, one simulated crop row and one field stop per species, all from held-out test plants.
| species | kind | folder | item | models ||---|---|---|---|---|| sorghum | plant | `samples/sorghum/plant_Sorghum_10756` | Sorghum_10756, view 00 (test split) | sorghum-generalist || sorghum | row | `samples/sorghum/row_Sorghum_10756_yaw90` | Sorghum_10756, simulated row seen at yaw 90 deg, two neighbours (test split) | sorghum-row || sorghum | field | `samples/sorghum/field_p1d2V_329956_row0280_stop10` | field row 280, camera stop 10, middle plant p1d2V_329956 (held-out test plant) | sorghum-row, sorghum-field || maize | plant | `samples/maize/plant_0320` | plant_0320, view 00 (test split) | maize-generalist || maize | row | `samples/maize/row_plant_0320_yaw90` | plant_0320, simulated row seen at yaw 90 deg, two neighbours (test split) | maize-row || maize | field | `samples/maize/field_0204_row0936_stop06` | field row 936, camera stop 6, middle plant 0204 (held-out test plant) | maize-row, maize-field |
Each sample folder holds:- `inputs.npz`: the tensors the model reads, written by the training loaders. `rgb` (3, 224, 224) is ImageNet-normalised with the plant on black; `depth` (1, 224, 224) is the encoded depth, 0 for background; `pc` (N, 3) is the cloud centred and scaled to the unit sphere; `scale` gives metres per unit. When known, the truth: `gt_pc` (the target plant's cloud in the same frame), `height_m` and `leaves`.- `raw/`: the original files of the item (photograph, depth image, point clouds, the parameter file or plant table).- `input_rgb.png` and `preview.png` (input photo, depth and the predicted procedural model).- `reference/<model>__<source>/`: the outputs of `inference.py` on CPU with seed 0, to check a setup against. A rerun gives the same numbers; the clouds can differ in the last float digits (a few micrometres) with the number of CPU threads.
To run a model on your own data, prepare `inputs.npz` the same way. The loaders in the code repository(`sorghum_dataset_4m.py`, `maize_dataset_4m.py`, `row_dataset.py`, `eval/real_rows.py`) do the conversion. Theprocedural parameters are never an input: the script passes zeros in their place.
## Reference results on the samples
Chamfer distance in 1e-4 m^2 against the truth cloud, height in metres and leaf count as predicted / true.Rows: all three streams in, and for the isolated plants each stream alone. Full table:`samples/reference_results.csv`. These are single items, not benchmark numbers; the paper reports the test sets.
| species | kind | model | input | Chamfer | height | leaves ||---|---|---|---|---|---|---|| sorghum | plant | `sorghum-generalist` | all | 12.83 | 0.63 / 0.66 | 13 / 13 || sorghum | plant | `sorghum-generalist` | rgb | 6.32 | 0.66 / 0.66 | 13 / 13 || sorghum | plant | `sorghum-generalist` | depth | 3.22 | 0.65 / 0.66 | 13 / 13 || sorghum | plant | `sorghum-generalist` | pc | 7.73 | 0.62 / 0.66 | 12 / 13 || sorghum | row | `sorghum-row` | all | 27.9 | 0.73 / 0.66 | 15 / 13 || sorghum | field | `sorghum-row` | all | 257.7 | 1.22 / 2.00 | 24 / 14 || sorghum | field | `sorghum-field` | all | 56.69 | 1.89 / 2.00 | 13 / 14 || maize | plant | `maize-generalist` | all | 5.42 | 1.09 / 1.18 | 11 / 11 || maize | plant | `maize-generalist` | rgb | 4.57 | 1.05 / 1.18 | 11 / 11 || maize | plant | `maize-generalist` | depth | 2.89 | 1.08 / 1.18 | 11 / 11 || maize | plant | `maize-generalist` | pc | 3.3 | 1.11 / 1.18 | 11 / 11 || maize | row | `maize-row` | all | 2.41 | 1.13 / 1.18 | 11 / 11 || maize | field | `maize-row` | all | 212.46 | 1.01 / 1.91 | 12 / 11 || maize | field | `maize-field` | all | 52.37 | 1.77 / 1.91 | 11 / 11 |
## Notes
- Reconstruction with `--source all` runs in the masked regime the models were trained in (80 % of tokens hidden, seeded by `--seed`). Different seeds give slightly different clouds.- The sorghum models read photographs at the brightness they were trained on; the loaders handle this, and the samples are stored that way.- The sorghum field model reads a leaf count from its leaf slots (slots longer than 5 cm). The other sorghum models write 24 leaf slots and derive the count from the stem length, as in the simulated plants.- Synthetic training data: 15,000 procedurally generated plants per species, ten views each. Field rows: real plants (maize: 520 scanned plants; sorghum: 51 scans), split by plant for fine-tuning and testing.
## License
The models, code and samples in this repository are released under the Apache License 2.0 (`LICENSE`).
`SHA256SUMS` lists a checksum for every file.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSEab677c905aae596982e1aacba7516579ed5d62b3a001f596067f98a6a3493a12 README.md838b49dac21c7dbe89c90d1bc995a6988c505e0aaaf2043f4223ac0c2d45a518 cropcode_model/embodied_mae.py8f1717c7e6667363a0ca98e5e09cdde97ab10aa7597345b3bb820ff4fe150460 cropcode_model/embodied_mae_4m.py17e7d9e1b70e9532f7fb3b17316270ef18b51323ed3009889a10567e23d529d1 cropcode_model/embodied_mae_4m_maize.py1a202169af437b88617c5e542775c8fd17457bc258e043d83105e4205e0ed1d0 cropcode_model/pc_sinkhorn.pyb4f184eca2cdd460158e2fa13d77c6d13decaf290585aad524af8ec8815888c4 inference.py9f66c0eb38e2ee616f0351e3cf776cad2242fdf79b442699bb018e9704bd753b models/maize-field/config.jsonf71ec778448b89c136eaa38659542ca0ab5cc5d4b491a2cff92b3d3de2472d9b models/maize-field/model.safetensors156d100398080e61f0cd93a4d36d7d6ea09f145291f381c216d2cfff7c7eb222 models/maize-generalist/config.json50b889d8baade2e33726fb4fd4858beb0059f848421327a7f79eb58d3ef46cc0 models/maize-generalist/model.safetensors9bdada27805edbe22b00f06ee36e05b89c52978c33418ed898972f53c8ac07e8 models/maize-row/config.json27a4f4dd27f059d011325dca495b9d62f549e321dc9c18048098be7e8a017aec models/maize-row/model.safetensors53527168c8a926d9aadaa5634d0949976fa1673cb200f28d9e7c33a6c253c8eb models/sorghum-field/config.jsonab88e1d837fcefc36dabe69fc0458d13a96fca866e8bcd4aff20b74c56cb1d59 models/sorghum-field/model.safetensors1fee351194b0e5c4095cfca0e0b92023d68744d033ea36f93e6af0e7a3d4672b models/sorghum-generalist/config.jsond707026e4fa129c70a047d08d4279616708cb84d031ef449bcd2e21b7bada2e8 models/sorghum-generalist/model.safetensors72844b76039c148cd8b6dbebda310cbb369853810065bb7439779254c2a9ff2b models/sorghum-row/config.json47b72acfb61fb74a83dae9e458fb4e2747894c09ba734a3c62ec171170d0e3bf models/sorghum-row/model.safetensors7ab7a9ed8eda5d3bfff0f5d7a50c2b37d019a3c254414dac0ef637104e7ea20f requirements.txt84d47a89638a3e32401574ea5fcc308d9e758cd9f757d0fa8a9ea72ed640db17 samples/maize/field_0204_row0936_stop06/input_rgb.png709ab96e6262dc2868731c724d9e78db73252d45b3eac40a6814df0c380fd454 samples/maize/field_0204_row0936_stop06/inputs.npz946d6a6baa1644ec52c5097d9a387f859572468fa50483254cd216acbabb5673 samples/maize/field_0204_row0936_stop06/preview.png26ff7776a878528e9909f1fd8f77ad465058f4012248faad267844f72693bd37 samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.csvfccf10f779190d59a9dceb53ff68e5cccba85937a2995993514b1512b0b9a003 samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.pcd921133620ac1bda55a1754da85ba550bb047d5f4078bdd9417309536f82ce479 samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.png9b0998b2df58c1f657cebe34455e4493f96caed3ab67280af2e463194b9ef324 samples/maize/field_0204_row0936_stop06/reference/maize-field__all/pred_cloud.ply092649d9bb227463315c348103a977933dad3f218079eb711ab4fff4e3b5275a samples/maize/field_0204_row0936_stop06/reference/maize-field__all/recipe.json8d10834d1d7426c1008f4cb57cefbc7c55b007fbc60714d5c38247bec9148277 samples/maize/field_0204_row0936_stop06/reference/maize-field__all/summary.jsond018e3d378ae52718c6a45a84e08086d45577ed5655c303e30a7de5ebc4a957d samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/pred_cloud.ply8b9289fcc03545da3205eebf60aaa98bec2fda656e8d5d19eb8d8973edd1f7e0 samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/recipe.jsonac1c6f237f8ceb4054ffe3b02883c0baefa563686c28b1190bce959da610a6f0 samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/summary.jsonf98937aa195626308fcb8741d1800e328c7761db343ef617ec6eb33dc70e4db8 samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/pred_cloud.ply0af4ec1216b2e1dce2f705a1a83d5cce79a12b34e9113ba51fe984aeed60a7af samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/recipe.jsonfb852dfd6df2ca99625fc45ed483d0ee1c0473562c929f41d4561a3681b0cf5d samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/summary.json455478b296e0f304dbcd2d660c2d8cabab3bb2807914ecd93ff695c043669851 samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/pred_cloud.ply39f9b714fd8d812dc887f03e141d2f44a59a2737573cc8fd83c01e21d50b43f4 samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/recipe.jsonc82c32047244c30a4ed029f4dc0308f011684451d7a15515a2983f6954bc31f8 samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/summary.json8140acdeb7560762479a934d1a67c5500b0b2ee6de5492c37a9651cd541d610f samples/maize/field_0204_row0936_stop06/reference/maize-row__all/pred_cloud.ply2caa227e5022f4fa96819d32da5047008ac4346f05034afb55f2ea8a5a23976c samples/maize/field_0204_row0936_stop06/reference/maize-row__all/recipe.json60cf0185b4f9ca6a9efc1768835ee4a841a857161850b51943edcb51804e398c samples/maize/field_0204_row0936_stop06/reference/maize-row__all/summary.json15219111a410b9f2614a74dbf78b5c61976d6a59f5f2c2a9fc78f89a5d26a5a6 samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/pred_cloud.ply670cc56486fcc9f95d3345efd7a1197b3e30947012c3560e38a01d616171076d samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/recipe.jsonba0d939f8b4604c344917cc862b530fc5b6385e9e24d9e1d3beaf9c0e2e0c523 samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/summary.jsoncbf48f27ec533095d7cf016414f43cbbfd065d397fcd195ad060500f7a240d05 samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/pred_cloud.plyf36ef2955dc15d2221da670e35648bbd4b50748e69b2cd00ee37748f08a01c62 samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/recipe.jsone26069c3569458b1c334a9c33637cfb022b96850754cde36e897ca5feadab6e5 samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/summary.jsonb736f4f2d7d9fd03c34d1e7930ff46e4671203e6d9e6cca6ba2a544869c4a14c samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/pred_cloud.ply178697acc39ad1b7358679023e03b1cdde206751324030d8fa197c972a48156c samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/recipe.json5d9a6652130a3f602743e3d947ba7f30873a77e72a5928f6061b9a2a0c6507af samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/summary.jsonf01a27177d09ce0ae341056e70900413429c006f0ce77187197bccddffd4d55a samples/maize/plant_0320/input_rgb.png7ebbb332a02d9eff8f5206ca55b8f2e0824855e4a900a58bedd9e52974a2b419 samples/maize/plant_0320/inputs.npz03d123f63130957e873da27d0d79a1a109afad540b4c80c2fa54282cdc139932 samples/maize/plant_0320/preview.png33cfd50f05953eb75d52c3b3d8ab0051209fa4a4bd4e88273439155854eeb86d samples/maize/plant_0320/raw/camera_pose.jsonf15cb3a5c230e2d1f33a9ca1e4678ea69bc90f007372677ea802a293f4c9fc12 samples/maize/plant_0320/raw/depth.png910808fc7a79add2e3369cfc4624e9c4d6e7f86364391cfd3d8162470553e732 samples/maize/plant_0320/raw/maize_0320_spline.xmlc917aa4437d25bad4377591c59facce291d3c1390da63ebec86b49f52a9294db samples/maize/plant_0320/raw/pointcloud_cam.ply1fb51d241aba609aaf1b41696e0a87f3e1843640143155fb2f5b8989be5c71ce samples/maize/plant_0320/raw/rgba.pngfb548f410f03c49be7134eadedac195c27fcb7cfb69d802e34346befff309e6d samples/maize/plant_0320/reference/maize-generalist__all/pred_cloud.ply6946ddec58d037ee6f417259586b3ee5d05f23809bc8e29c0bf40714cd12c83c samples/maize/plant_0320/reference/maize-generalist__all/recipe.json765d2d526dd67c4b78ea37a1d87a1d1cbe2f49bc7af6273c12bbd6d9405817d9 samples/maize/plant_0320/reference/maize-generalist__all/summary.json0b6192d43d9cb3f8b78facc0120b48db6853e3ab090b381dfaed75c81dc85735 samples/maize/plant_0320/reference/maize-generalist__depth/pred_cloud.ply5c621c98e8e286291e94573c32d99309289599a2c22ad8f52464c4b275b4a1d4 samples/maize/plant_0320/reference/maize-generalist__depth/recipe.json262cdd07b5b00b52fa1843adc489a4efe9fbf9867b63bbc91facba3e63b1a22b samples/maize/plant_0320/reference/maize-generalist__depth/summary.jsonec731840efa4b0e68a2df38915e54dfdd1b36e9d22dedbc75b256133f08e80b1 samples/maize/plant_0320/reference/maize-generalist__pc/pred_cloud.ply6d04be42f4ca72f36c7ea8e69b604b043b2fb5f1d3316c5a5f9472d6ad325b54 samples/maize/plant_0320/reference/maize-generalist__pc/recipe.jsone193e22d8c1b0e311133c2297854f6cf27c9b81b718c86747b2d29a44a9e910f samples/maize/plant_0320/reference/maize-generalist__pc/summary.jsonafc75dea84d61e435972a77102018ea7a957f540df319f5c8ed842d1700146cb samples/maize/plant_0320/reference/maize-generalist__rgb/pred_cloud.plyff6db79da2fcfe7f1113a3e64fe0000bd20ba40cbf98b32a0e7e33a4f0a5e95e samples/maize/plant_0320/reference/maize-generalist__rgb/recipe.json57d0f65b2ce8e7f8d130c58e9bd03155b03f5d359fc694e9befbc4df50aa726d samples/maize/plant_0320/reference/maize-generalist__rgb/summary.json57d9c59050df193f44a642da50ea62c5e2c0753fb72ee7b43467522f726b5bde samples/maize/row_plant_0320_yaw90/input_rgb.png288bfd22e3159031d57db1540f1d4fdfb6056bc1aafbcd427857442f0b43cee4 samples/maize/row_plant_0320_yaw90/inputs.npz7be16f7b127d6a522e01f1bab2d021f2b0af1248c8e3377a6deff0885c135a87 samples/maize/row_plant_0320_yaw90/preview.png38b0c916f38d06b5b6643b7673f5133c9ce76491d6f0f559eef28e188d80bf1d samples/maize/row_plant_0320_yaw90/raw/camera_pose.json00906c9120565e7bf626dd9203c0d38146b8b694fa21da04f22af9d2d59d28ae samples/maize/row_plant_0320_yaw90/raw/depth.pngb9dc86252dcb41f1ed81a673d4f3a9f30d428e25ffcee6221cf52bec5fa110b2 samples/maize/row_plant_0320_yaw90/raw/gt_depth.pngeaabc7cbecb2030ed19103c0edba64a47771664ce828308f7a0988dc3e30a157 samples/maize/row_plant_0320_yaw90/raw/gt_pointcloud_cam.ply37c78d5ae15569feeddb864f1db6bd04b53fc8589e493aa27511debe760bda5f samples/maize/row_plant_0320_yaw90/raw/gt_rgba.png910808fc7a79add2e3369cfc4624e9c4d6e7f86364391cfd3d8162470553e732 samples/maize/row_plant_0320_yaw90/raw/maize_0320_spline.xml77fbeb6492853447430a9ca1d9c5680a70788d0e794f9b528e18acfb3b214bf1 samples/maize/row_plant_0320_yaw90/raw/pointcloud_cam.ply422747596549cb95076e517d94f178f8bc7ffef8508b26496afaee9af5432017 samples/maize/row_plant_0320_yaw90/raw/rgba.png06771414dde915aa2c83c0b70fb4e9e7434ed51f2704b8e80addefc9b81d145d samples/maize/row_plant_0320_yaw90/raw/row.json466b99e425e0a70cb3e9f1ac58d7fc8042517292ba465e59078dd4474d6677a5 samples/maize/row_plant_0320_yaw90/reference/maize-row__all/pred_cloud.plya3277bba0853498658d8a4345de4d7303c8eb2dea9f368e1452cc1f77d629360 samples/maize/row_plant_0320_yaw90/reference/maize-row__all/recipe.jsona6a18e5c4ccec00e3b7130b84e45d0f38db271c3e86801023b355e29216c8eaa samples/maize/row_plant_0320_yaw90/reference/maize-row__all/summary.jsond5b40bb12441c4e4154f99737452081d8f7c529f95207367409ad5edccb325c4 samples/maize/row_plant_0320_yaw90/reference/maize-row__depth/pred_cloud.ply4ae905ae9d63d67c89f63c4c2f593c7ef0ea831e58215ef3d1624ab5a53fa16d samples/maize/row_plant_0320_yaw90/reference/maize-row__depth/recipe.json33b8aa810838da90be5f75cbb01304c1228bc36c9a7c078b0cfa54fe502764de samples/maize/row_plant_0320_yaw90/reference/maize-row__depth/summary.jsonb19ed1ecfe20e531d4e1e1f4c56697ce38650c50df8749148ab08a4ad267cbee samples/maize/row_plant_0320_yaw90/reference/maize-row__pc/pred_cloud.ply3aee8d2f609c1221a30eaf0edd870486d2fd60cb88ecd5758b726c2ef201410f samples/maize/row_plant_0320_yaw90/reference/maize-row__pc/recipe.json6235d4d0deb4511eb9211d4bc82da65858e5e0e57a9483c76adb9ecdfa0a1833 samples/maize/row_plant_0320_yaw90/reference/maize-row__pc/summary.jsond4101c15c6467c2af6bc902b9a23e27c5860b7572a045814dd709604d0d4b74b samples/maize/row_plant_0320_yaw90/reference/maize-row__rgb/pred_cloud.ply2c2238af46eb626bf619edd018e26e3e66017280884e41a41a6b6d5034b35fba samples/maize/row_plant_0320_yaw90/reference/maize-row__rgb/recipe.json6c0b6595afb84ca1f4f2bd7d03f5a9e52fe3556c76950e5c3040dc9a5bd48f5f samples/maize/row_plant_0320_yaw90/reference/maize-row__rgb/summary.json1f7d85171c92e60bbb552f2f6857731941ecc56118f27feff9e01a7aac3d3322 samples/reference_results.csv27000ecfb036f7417b0e18941d020c2a9b6cc142ebaafcd5624e1d674e85b190 samples/sorghum/field_p1d2V_329956_row0280_stop10/input_rgb.pnga602f8466f96decf3deae1e27f6307f667340d535a9943947faffdc7498278fc samples/sorghum/field_p1d2V_329956_row0280_stop10/inputs.npz547cad643b03813652bb79f52b61626e55b868fc8f79f0472a1e851275c6ca6b samples/sorghum/field_p1d2V_329956_row0280_stop10/preview.png94fb2010d95f31a614258a84deca2f6512854e202d6898ae6430b1ca3fbdf863 samples/sorghum/field_p1d2V_329956_row0280_stop10/raw/row280_seed1_stop10_full.csve6bf9fd065c0549aa7d103403c2e4e1b026c6aac925b035dfbbd37af74d1a1a2 samples/sorghum/field_p1d2V_329956_row0280_stop10/raw/row280_seed1_stop10_full.pcd0a6e410fc20223131c161b664b3b58e6b406dca83cac7ee56c80e23a64bcd52e samples/sorghum/field_p1d2V_329956_row0280_stop10/raw/row280_seed1_stop10_full.png273800dba611c88b5baa914ec695eedc56630112cab1af3bc038bbc08a726b45 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__all/pred_cloud.plyeb7c2ead1c5cfe87d193c6a00099799a40cf385d03684616eea8a634cfa5463e samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__all/recipe.jsonb2ce8e7e3352fb2f2fbbea9b11f87970fdb57bda8a91517286f34cba0d34742f samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__all/summary.json5c752c9dc2a9edd8220a943f1af76ce3c486b6d7a8db6280b684119afe9bd98b samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__depth/pred_cloud.plyfdb1054836c0d1943e76d72af897e79687475bcba4b3327b24457bb3ee5a7bb5 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__depth/recipe.jsonefa9417ed46d8beddd397de03e9746a8ce5a4ecf5fbc7b443c00a7e42ec5d122 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__depth/summary.jsone43697162656a6ee843fbf127e2bd8ce74b569a7551ac19d4e369225ec28a91e samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__pc/pred_cloud.ply9db080077274cfb94562c3abc486c56be6126938aded1755fcceaa390dc623c3 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__pc/recipe.jsond3baeb6570aaaeed550560e8850cdd14465f4e9d26e75356306f6d505ab64eab samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__pc/summary.jsonab4332a44878f320be08a466bce687b8549f0a7b6920477115ab1e6d654a6f4f samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__rgb/pred_cloud.plyb444e3ca3dcb45f0ef49c2b28513899f32bd803db0b733d6bff25b94fb3de79a samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__rgb/recipe.jsoneb502bfb6ef07901ddd9162e3f81558e5e5ac9d608d23738dd0a475333efda6f samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-field__rgb/summary.json2293b7c46a4629960fb3f23f67365d84c8fd7a4e0cd0a49da019605af4e924d8 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__all/pred_cloud.plyc15cd419e02fec7e2ad85f6480c8ad5f9b4d56d12fe0c3bcb00787d7644be856 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__all/recipe.jsonb0e0d7bf91cfd919986fb738a548de1a417c3140eeb7f2bf9af46ef35455c274 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__all/summary.json1838f813d41b1919d833346810c0c69d5688111dfdce5811b67656027b2dcf39 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__depth/pred_cloud.ply78f749a179d0db7e2a436208897694978a81cf378aa172228c4cc27863919e55 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__depth/recipe.jsonfafe6006e8906823d0d5f67e92349310314fee43c5ea93f6e449d80b7ac19616 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__depth/summary.json85b567ecba55cc051a71e9df292fce49251f01f2ac7afb060d97a4b9d735f5db samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__pc/pred_cloud.ply253f2140d17bb4951568a05c89ced965dc2bf219d6533fc411b0584db818c867 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__pc/recipe.json1bac39c6a2b645d1e93bdf24d58c28b09313749401703deeab9a32bda3f80602 samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__pc/summary.jsonf8cf12760f1e86cb66d30a524bd96082994a7b447e945273da0cc1987b2d7eeb samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__rgb/pred_cloud.ply10c63c45e49ad54af59865634b47ef58380f03f9006d6ca5f9079deb3b82de8a samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__rgb/recipe.json314bb81fda1b2e783ceca74ef8d7951f31b97ab1dfaf6ba13304b59746d8391e samples/sorghum/field_p1d2V_329956_row0280_stop10/reference/sorghum-row__rgb/summary.jsone9d3d0ed440d6375bfc007e648dbea7346755b65438e00c799e6aea7e2d3fd0c samples/sorghum/plant_Sorghum_10756/input_rgb.png6dcdde90d3519bea5f166e3fc77c395e314210b1911f7a5c585e1e82dcaf7114 samples/sorghum/plant_Sorghum_10756/inputs.npz882a5c6530370ad85cf8562e0cfe197eff84a4b241bbb2574c03e0c0d5e6af55 samples/sorghum/plant_Sorghum_10756/preview.png4baddf541b03d84e21b6296e65d75ce4ff71329b5be85ac977fffdaad957ae3d samples/sorghum/plant_Sorghum_10756/raw/Sorghum_10756_nc_cam.plyc4a604b358c33bd4c049d03b0e8908da7b31fc3ff51f46ae535ee6781193dce5 samples/sorghum/plant_Sorghum_10756/raw/Sorghum_10756_spline.yml9f3407e680db8aed582036a94d90f737449b1dbbc664db754bf1d35f12cbbd24 samples/sorghum/plant_Sorghum_10756/raw/depth.png54a72d95e13f21fea2dfaa50f532fa467dd7b2b8389f15c121bb398c318c38a5 samples/sorghum/plant_Sorghum_10756/raw/rgb_nobg.png196f36c40c81710afb402dcf2223c7e9b595cf1e9cd757705cf248ecee6dd424 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__all/pred_cloud.ply518e0c8085b04f183bc04db81db374794298e437182fba96e992eee8023b23be samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__all/recipe.jsonda385ebd4ec4889cfae19a2b5e4102d63d5d0a02cbad4161abc08bc98df6215a samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__all/summary.json83d2e4d56187604357a3a58e1370f0de7ec92679e27cfe5310c226114c446949 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__depth/pred_cloud.plye92f64890f3f40e2bba437f4e59c9f11825cf9f08319c51eeb5818978d6563f8 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__depth/recipe.jsona0f2b999a9aca1128f793b1e4f2478352898e0211f7641baa04c9a217d1460d9 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__depth/summary.json664686c2a1f2e8b9938bd94c31486085eed69151a24133b2ba7f2d9c56dfbd1c samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__pc/pred_cloud.plyf05dcb0eef0e5004d61adfbf9043c0dc329e5aec9f50ff6821489bb5764f5df6 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__pc/recipe.json815e7e8289ae192c4d399ded0cf7afee132f50c06386d9b912331218280f26b9 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__pc/summary.json79e65f406a7cff1fa717e3eaa589011785ff03f44c9687f8de80cfebe9f1652e samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__rgb/pred_cloud.ply958d738121e603b2f1c49d8175c5bc6b46f06af45c4f29e1b476b9b7be1c7ad5 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__rgb/recipe.json8c94ed56ef09be2f7a136210557a409a89b42c8a7bc5d72d72129ece519b5d16 samples/sorghum/plant_Sorghum_10756/reference/sorghum-generalist__rgb/summary.json08d86ed81e20c37f92a5306e047a322ac29dd5a41ebd6519913748f30ea35cc3 samples/sorghum/row_Sorghum_10756_yaw90/input_rgb.pngccb1cc6169d3d78addd864b851cafc8e56f96bc7506f5d83fdaaa7433fd75dd6 samples/sorghum/row_Sorghum_10756_yaw90/inputs.npz973b69827787653fca5f4262db7182ab627e397c5f54d54b3e168737672d9b17 samples/sorghum/row_Sorghum_10756_yaw90/preview.pngc4a604b358c33bd4c049d03b0e8908da7b31fc3ff51f46ae535ee6781193dce5 samples/sorghum/row_Sorghum_10756_yaw90/raw/Sorghum_10756_spline.yml2e95979d0d190810785d552dbfb3b6e6586965dca6acb00b0a366449fbcece7d samples/sorghum/row_Sorghum_10756_yaw90/raw/camera_pose.json0a683a76f41d54c0a2cf0aa241f5b0d78e38d91dfd5bf5a17e93c32d01830b6f samples/sorghum/row_Sorghum_10756_yaw90/raw/depth.png29e38c93d9a68ff2ea5494b028ec872ee0e5f12001a6f67b7483e586ef34c21e samples/sorghum/row_Sorghum_10756_yaw90/raw/gt_depth.pnga67db35f2c89ad3e3776b74215ab9e64e02b3877109b5b8c251c50fbd3d66ee3 samples/sorghum/row_Sorghum_10756_yaw90/raw/gt_pointcloud_cam.ply348c49fd46becd72c25382296dea3501df1ab8241631a311074d3790cbf69079 samples/sorghum/row_Sorghum_10756_yaw90/raw/gt_rgba.pngf384f1d0075e03b94ff04c8ebaa84ee1e0869b74bb965e7e255d7002ab50f80a samples/sorghum/row_Sorghum_10756_yaw90/raw/pointcloud_cam.ply883a4ec174519b9d60122c3ebaf6cd769dad90e168a19b03f5e4bdb007d5d38e samples/sorghum/row_Sorghum_10756_yaw90/raw/rgba.png19d32147aba5cd3a3471161063d5581075f0727a4d0bd08c54605ca104271a0d samples/sorghum/row_Sorghum_10756_yaw90/raw/row.json689fe4d94499f43cb49fa3e58987befa920fe90b8c69e6fd36e76974cd379142 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__all/pred_cloud.ply560598fb03cfee7a1679b3d7c82fd971405c548ff37470c3de0993fa64e4c6b8 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__all/recipe.json52871f2ae034ccb867ba26ebfeefd7f5be0e636ae0b6b2c6b3d1baf32d543409 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__all/summary.json286e9619072767a05637f4152773e859d2e9334beb973fb993ad4a8cc89f5354 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__depth/pred_cloud.ply3c4cb1f09149e9fd4d061110a2a50ad263aa5ba3cc20c81f3ca283d6b68e7928 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__depth/recipe.jsonc5b0ccf8cd90cde735b2ebe05e73e2e4828c4890b1ffc5403c8046b2bb78b246 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__depth/summary.jsonaa5a60bd0e2199ecefb53cb60bf4ad700d9474415f856498dd65b208d2f3995d samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__pc/pred_cloud.plyddbed6de1ecc0807438bed4477210dac7bc69822e0837468b9037c6957c8c08d samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__pc/recipe.jsone9fd862659da5be7d1ebd861691cf138f1ac84511f5d6c9e07d0755bab55760d samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__pc/summary.json3b3d8d7e2a09720f5627280276038216d8b96cc1bfc5c875ceaf92351e2c4b16 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__rgb/pred_cloud.plybe93c55219c5cbbc2e8cbdaee5349fbca990d33059929eb2eb5ac64e79f59f24 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__rgb/recipe.json259711d63a29e185bf91f5870400b02c09aa7a6b725d407c821c10376d18eba8 samples/sorghum/row_Sorghum_10756_yaw90/reference/sorghum-row__rgb/summary.json123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870"""EmbodiedMAE: A Unified 3D Multi-Modal Representation for Robot ManipulationPyTorch Implementation
Paper: https://arxiv.org/abs/2505.10105"""
import torchimport torch.nn as nnimport torch.nn.functional as Fimport numpy as np
def chamfer_distance(pred_pc, target_pc): """ Compute Chamfer Distance between predicted and target point clouds Args: pred_pc: (B, N, 3) predicted point cloud target_pc: (B, M, 3) target point cloud Returns: chamfer_dist: scalar Chamfer distance """ # pred_pc: (B, N, 3) # target_pc: (B, M, 3) # Expand dimensions for broadcasting # pred_pc: (B, N, 1, 3) # target_pc: (B, 1, M, 3) pred_expanded = pred_pc.unsqueeze(2) target_expanded = target_pc.unsqueeze(1) # Compute pairwise distances: (B, N, M) distances = torch.sum((pred_expanded - target_expanded) ** 2, dim=-1) # Forward direction: for each point in pred, find nearest in target min_dist_pred_to_target, _ = torch.min(distances, dim=2) # (B, N) forward_loss = torch.mean(min_dist_pred_to_target) # Backward direction: for each point in target, find nearest in pred min_dist_target_to_pred, _ = torch.min(distances, dim=1) # (B, M) backward_loss = torch.mean(min_dist_target_to_pred) # Chamfer distance is the sum of both directions chamfer_dist = forward_loss + backward_loss return chamfer_dist
def earth_movers_distance(pred_pc, target_pc, num_samples=1000): """ Compute Earth Mover's Distance (EMD) / Wasserstein Distance between point clouds Uses approximate EMD for efficiency with large point clouds: - Subsamples points for tractable computation - Uses Hungarian algorithm for optimal matching Args: pred_pc: (B, N, 3) predicted point cloud target_pc: (B, M, 3) target point cloud num_samples: Number of points to use for EMD calculation (default: 1000) Returns: emd: scalar Earth Mover's Distance """ try: from scipy.optimize import linear_sum_assignment except ImportError: print("⚠️ scipy not available, EMD will return 0. Install with: pip install scipy") return torch.tensor(0.0, device=pred_pc.device) B, N, _ = pred_pc.shape _, M, _ = target_pc.shape # For large point clouds, subsample for efficiency if N > num_samples: # Randomly sample points from pred indices_pred = torch.randperm(N, device=pred_pc.device)[:num_samples] pred_sampled = pred_pc[:, indices_pred, :] else: pred_sampled = pred_pc num_samples = N if M > num_samples: # Randomly sample points from target indices_target = torch.randperm(M, device=target_pc.device)[:num_samples] target_sampled = target_pc[:, indices_target, :] else: target_sampled = target_pc # Compute EMD for each batch emd_list = [] for b in range(B): pred_b = pred_sampled[b].cpu().detach().numpy() # (num_samples, 3) target_b = target_sampled[b].cpu().detach().numpy() # (num_samples, 3) # Compute pairwise distance matrix # dist_matrix[i, j] = distance from pred[i] to target[j] dist_matrix = np.sqrt(np.sum((pred_b[:, None, :] - target_b[None, :, :]) ** 2, axis=-1)) # Solve optimal assignment problem (Hungarian algorithm) row_ind, col_ind = linear_sum_assignment(dist_matrix) # EMD is the mean distance of optimal assignment emd_b = dist_matrix[row_ind, col_ind].mean() emd_list.append(emd_b) # Average across batch emd = torch.tensor(np.mean(emd_list), device=pred_pc.device, dtype=torch.float32) return emd
from typing import Tuple, Optional, Listimport math
class PatchEmbed(nn.Module): """ Image to Patch Embedding for RGB and Depth """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() self.img_size = img_size self.patch_size = patch_size self.num_patches = (img_size // patch_size) ** 2 self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size) def forward(self, x): B, C, H, W = x.shape x = self.proj(x) # (B, embed_dim, H/P, W/P) x = x.flatten(2).transpose(1, 2) # (B, num_patches, embed_dim) return x
class PointCloudEmbed(nn.Module): """ Point Cloud to Token Embedding Uses FPS (Farthest Point Sampling) and grouping """ def __init__(self, num_tokens=196, group_size=32, embed_dim=768): super().__init__() self.num_tokens = num_tokens self.group_size = group_size # Local feature extraction self.first_conv = nn.Sequential( nn.Conv1d(3, 128, 1), nn.BatchNorm1d(128), nn.ReLU(inplace=True), nn.Conv1d(128, 256, 1) ) self.second_conv = nn.Sequential( nn.Conv1d(512, 512, 1), nn.BatchNorm1d(512), nn.ReLU(inplace=True), nn.Conv1d(512, embed_dim, 1) ) def fps(self, xyz, npoint): """ Farthest Point Sampling """ device = xyz.device B, N, C = xyz.shape centroids = torch.zeros(B, npoint, dtype=torch.long).to(device) distance = torch.ones(B, N).to(device) * 1e10 farthest = torch.randint(0, N, (B,), dtype=torch.long).to(device) batch_indices = torch.arange(B, dtype=torch.long).to(device) for i in range(npoint): centroids[:, i] = farthest centroid = xyz[batch_indices, farthest, :].view(B, 1, 3) dist = torch.sum((xyz - centroid) ** 2, -1) mask = dist < distance distance[mask] = dist[mask] farthest = torch.max(distance, -1)[1] return centroids def knn_grouping(self, xyz, points, centroids_idx): """ K-NN grouping around sampled centers """ B, N, C = xyz.shape _, S, _ = centroids_idx.shape if len(centroids_idx.shape) == 3 else (B, centroids_idx.shape[1], 3) centroids = xyz[torch.arange(B)[:, None], centroids_idx] # Compute distances dist = torch.cdist(centroids, xyz) # (B, S, N) # Get k nearest neighbors _, idx = torch.topk(dist, self.group_size, dim=2, largest=False) # Group points grouped_xyz = xyz[torch.arange(B)[:, None, None], idx] # (B, S, k, 3) grouped_xyz = grouped_xyz - centroids.unsqueeze(2) # Normalize if points is not None: grouped_points = points[torch.arange(B)[:, None, None], idx] grouped_points = torch.cat([grouped_xyz, grouped_points], dim=-1) else: grouped_points = grouped_xyz return grouped_points def forward(self, xyz): """ Args: xyz: (B, N, 3) point cloud Returns: tokens: (B, num_tokens, embed_dim) """ B, N, _ = xyz.shape # Farthest point sampling fps_idx = self.fps(xyz, self.num_tokens) # Grouping grouped_points = self.knn_grouping(xyz, None, fps_idx) # (B, num_tokens, group_size, 3) # Local feature extraction grouped_points = grouped_points.permute(0, 1, 3, 2) # (B, num_tokens, 3, group_size) B, S, C, K = grouped_points.shape grouped_points = grouped_points.reshape(B * S, C, K) features = self.first_conv(grouped_points) # (B*S, 256, K) features_global = torch.max(features, dim=2)[0] # (B*S, 256) features = torch.cat([features, features_global.unsqueeze(-1).expand(-1, -1, K)], dim=1) features = self.second_conv(features) # (B*S, embed_dim, K) features = torch.max(features, dim=2)[0] # (B*S, embed_dim) tokens = features.reshape(B, S, -1) # (B, num_tokens, embed_dim) return tokens
def qal_loss(pred_pc, target_pc, threshold=0.01, alpha=100.0, use_squared=False): """Distance-aware, two-sided Chamfer loss used by the QAL runs.
Nearest-neighbour errors above ``threshold`` receive progressively larger sigmoid weights. This preserves both Chamfer directions while focusing optimisation on poorly reconstructed geometry such as thin leaves.
Args: pred_pc: (B, N, 3) predicted point cloud. target_pc: (B, M, 3) target point cloud. threshold: Euclidean distance at the sigmoid midpoint. alpha: Sigmoid sharpness. use_squared: Weight squared distances instead of Euclidean distances.
Returns: Scalar QAL loss. """ if threshold < 0: raise ValueError(f"QAL threshold must be non-negative, got {threshold}") if alpha <= 0: raise ValueError(f"QAL alpha must be positive, got {alpha}")
distances = torch.cdist(pred_pc, target_pc, p=2) pred_to_target = distances.min(dim=2).values target_to_pred = distances.min(dim=1).values
pred_weights = torch.sigmoid(alpha * (pred_to_target - threshold)) target_weights = torch.sigmoid(alpha * (target_to_pred - threshold))
if use_squared: pred_to_target = pred_to_target.square() target_to_pred = target_to_pred.square()
return ((pred_weights * pred_to_target).mean() + (target_weights * target_to_pred).mean())
def get_2d_sincos_pos_embed(embed_dim, grid_size): """ Generate 2D sinusoidal positional embeddings """ grid_h = np.arange(grid_size, dtype=np.float32) grid_w = np.arange(grid_size, dtype=np.float32) grid = np.meshgrid(grid_w, grid_h) grid = np.stack(grid, axis=0) grid = grid.reshape([2, 1, grid_size, grid_size]) pos_embed = get_2d_sincos_pos_embed_from_grid(embed_dim, grid) return pos_embed
def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): assert embed_dim % 2 == 0 # Use half of dimensions for x and y emb_h = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[0]) emb_w = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[1]) emb = np.concatenate([emb_h, emb_w], axis=1) return emb
def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): assert embed_dim % 2 == 0 omega = np.arange(embed_dim // 2, dtype=np.float32) omega /= embed_dim / 2. omega = 1. / 10000**omega pos = pos.reshape(-1) out = np.einsum('m,d->md', pos, omega) emb_sin = np.sin(out) emb_cos = np.cos(out) emb = np.concatenate([emb_sin, emb_cos], axis=1) return emb
class Attention(nn.Module): def __init__(self, dim, num_heads=8, qkv_bias=False, attn_drop=0., proj_drop=0.): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.scale = head_dim ** -0.5 self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias) self.attn_drop = nn.Dropout(attn_drop) self.proj = nn.Linear(dim, dim) self.proj_drop = nn.Dropout(proj_drop) def forward(self, x): B, N, C = x.shape qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4) q, k, v = qkv[0], qkv[1], qkv[2] attn = (q @ k.transpose(-2, -1)) * self.scale attn = attn.softmax(dim=-1) attn = self.attn_drop(attn) x = (attn @ v).transpose(1, 2).reshape(B, N, C) x = self.proj(x) x = self.proj_drop(x) return x
class MLP(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features self.fc1 = nn.Linear(in_features, hidden_features) self.act = act_layer() self.fc2 = nn.Linear(hidden_features, out_features) self.drop = nn.Dropout(drop) def forward(self, x): x = self.fc1(x) x = self.act(x) x = self.drop(x) x = self.fc2(x) x = self.drop(x) return x
class TransformerBlock(nn.Module): def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, drop=0., attn_drop=0.): super().__init__() self.norm1 = nn.LayerNorm(dim) self.attn = Attention(dim, num_heads=num_heads, qkv_bias=qkv_bias, attn_drop=attn_drop, proj_drop=drop) self.norm2 = nn.LayerNorm(dim) mlp_hidden_dim = int(dim * mlp_ratio) self.mlp = MLP(in_features=dim, hidden_features=mlp_hidden_dim, drop=drop) def forward(self, x): x = x + self.attn(self.norm1(x)) x = x + self.mlp(self.norm2(x)) return x
class EmbodiedMAE(nn.Module): """ EmbodiedMAE: Multi-modal Masked Autoencoder for RGB, Depth, and Point Cloud """ def __init__( self, img_size=224, patch_size=16, in_chans_rgb=3, in_chans_depth=1, num_pc_tokens=196, pc_group_size=32, embed_dim=768, depth=12, num_heads=12, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, mlp_ratio=4., norm_pix_loss=True, dirichlet_alpha=1.0, pc_loss_weight=50.0, target_points=10000, normalize_depth_global=True, depth_norm_type='minmax' ): super().__init__() # Configuration self.img_size = img_size self.patch_size = patch_size self.num_patches = (img_size // patch_size) ** 2 self.num_pc_tokens = num_pc_tokens self.embed_dim = embed_dim self.norm_pix_loss = norm_pix_loss self.dirichlet_alpha = dirichlet_alpha self.pc_loss_weight = pc_loss_weight self.normalize_depth_global = normalize_depth_global self.depth_norm_type = depth_norm_type # 'minmax' or 'standard' # Patch embeddings for each modality self.rgb_embed = PatchEmbed(img_size, patch_size, in_chans_rgb, embed_dim) self.depth_embed = PatchEmbed(img_size, patch_size, in_chans_depth, embed_dim) self.pc_embed = PointCloudEmbed(num_pc_tokens, pc_group_size, embed_dim) # Modality embeddings self.modality_embed_rgb = nn.Parameter(torch.zeros(1, 1, embed_dim)) self.modality_embed_depth = nn.Parameter(torch.zeros(1, 1, embed_dim)) self.modality_embed_pc = nn.Parameter(torch.zeros(1, 1, embed_dim)) # Positional embeddings self.pos_embed_2d = nn.Parameter(torch.zeros(1, self.num_patches, embed_dim), requires_grad=False) self.pos_embed_pc = nn.Parameter(torch.zeros(1, num_pc_tokens, embed_dim), requires_grad=True) # CLS token self.cls_token = nn.Parameter(torch.zeros(1, 1, embed_dim)) # Encoder self.encoder_blocks = nn.ModuleList([ TransformerBlock(embed_dim, num_heads, mlp_ratio, qkv_bias=True) for _ in range(depth) ]) self.encoder_norm = nn.LayerNorm(embed_dim) # Decoder self.decoder_embed = nn.Linear(embed_dim, decoder_embed_dim, bias=True) self.mask_token = nn.Parameter(torch.zeros(1, 1, decoder_embed_dim)) self.decoder_pos_embed_2d = nn.Parameter( torch.zeros(1, self.num_patches, decoder_embed_dim), requires_grad=False ) self.decoder_pos_embed_pc = nn.Parameter( torch.zeros(1, num_pc_tokens, decoder_embed_dim), requires_grad=False ) self.decoder_blocks = nn.ModuleList([ TransformerBlock(decoder_embed_dim, decoder_num_heads, mlp_ratio, qkv_bias=True) for _ in range(decoder_depth) ]) self.decoder_norm = nn.LayerNorm(decoder_embed_dim) # Reconstruction heads (modality-specific) self.decoder_pred_rgb = nn.Linear(decoder_embed_dim, patch_size**2 * in_chans_rgb, bias=True) self.decoder_pred_depth = nn.Linear(decoder_embed_dim, patch_size**2 * in_chans_depth, bias=True) # Point cloud reconstruction - upsample from tokens to full point cloud # Each token will generate multiple points to reach target_points (e.g., 10000) self.target_points = target_points # Target number of output points self.points_per_token = self.target_points // num_pc_tokens # e.g., 10000/196 ≈ 51 # Folding-based upsampling (inspired by FoldingNet and Point-MAE) self.decoder_pc_proj = nn.Linear(decoder_embed_dim, 512, bias=True) self.decoder_pc_fold = nn.Sequential( nn.Linear(512 + 2, 512), # +2 for 2D grid coordinates nn.ReLU(), nn.Linear(512, 512), nn.ReLU(), nn.Linear(512, 3) # Output (x, y, z) ) self.initialize_weights() def initialize_weights(self): # Initialize positional embeddings pos_embed_2d = get_2d_sincos_pos_embed(self.embed_dim, int(self.num_patches**.5)) self.pos_embed_2d.data.copy_(torch.from_numpy(pos_embed_2d).float().unsqueeze(0)) decoder_pos_embed_2d = get_2d_sincos_pos_embed( self.decoder_blocks[0].norm1.normalized_shape[0], int(self.num_patches**.5) ) self.decoder_pos_embed_2d.data.copy_(torch.from_numpy(decoder_pos_embed_2d).float().unsqueeze(0)) # Initialize point cloud positional embeddings randomly nn.init.normal_(self.pos_embed_pc, std=.02) nn.init.normal_(self.decoder_pos_embed_pc, std=.02) # Initialize modality embeddings nn.init.normal_(self.modality_embed_rgb, std=.02) nn.init.normal_(self.modality_embed_depth, std=.02) nn.init.normal_(self.modality_embed_pc, std=.02) # Initialize cls token and mask token nn.init.normal_(self.cls_token, std=.02) nn.init.normal_(self.mask_token, std=.02) # Initialize weights self.apply(self._init_weights) def _init_weights(self, m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bias, 0) elif isinstance(m, nn.LayerNorm): nn.init.constant_(m.bias, 0) nn.init.constant_(m.weight, 1.0) def random_masking_dirichlet(self, x_rgb, x_depth, x_pc, mask_ratio_total=0.75): """ Random masking using Dirichlet distribution to allocate visible tokens.
A single Dirichlet sample determines the modality split for the whole batch, so all samples have identical visible-token counts per modality. This avoids the padding/zero-token corruption that arises from per-sample allocation. """ B = x_rgb.shape[0] L_rgb = x_rgb.shape[1] L_depth = x_depth.shape[1] L_pc = x_pc.shape[1]
total_tokens = L_rgb + L_depth + L_pc num_visible_total = int(total_tokens * (1 - mask_ratio_total))
# One Dirichlet draw per batch step — varies across iterations, uniform within batch alpha = torch.ones(3) * self.dirichlet_alpha lambdas = torch.distributions.Dirichlet(alpha).sample() # (3,)
# Each modality draws from its own lambda — symmetric allocation. # Using the last modality as a remainder biases it toward full visibility. num_visible_rgb = max(1, min(int(lambdas[0].item() * num_visible_total), L_rgb)) num_visible_depth = max(1, min(int(lambdas[1].item() * num_visible_total), L_depth)) num_visible_pc = max(1, min(int(lambdas[2].item() * num_visible_total), L_pc))
def _mask(x, num_visible, L): noise = torch.rand(B, L, device=x.device) ids_shuffle = torch.argsort(noise, dim=1) ids_restore = torch.argsort(ids_shuffle, dim=1)
ids_keep = ids_shuffle[:, :num_visible] x_vis = torch.gather(x, 1, ids_keep.unsqueeze(-1).expand(-1, -1, x.shape[2]))
mask = torch.ones(B, L, device=x.device) mask[:, :num_visible] = 0 mask = torch.gather(mask, 1, ids_restore)
return x_vis, mask, ids_restore
x_rgb_vis, mask_rgb, ids_restore_rgb = _mask(x_rgb, num_visible_rgb, L_rgb) x_depth_vis, mask_depth, ids_restore_depth = _mask(x_depth, num_visible_depth, L_depth) x_pc_vis, mask_pc, ids_restore_pc = _mask(x_pc, num_visible_pc, L_pc)
return (x_rgb_vis, x_depth_vis, x_pc_vis, mask_rgb, mask_depth, mask_pc, ids_restore_rgb, ids_restore_depth, ids_restore_pc) def forward_encoder(self, x_rgb, x_depth, x_pc, mask_ratio=0.75): """ Forward pass through encoder """ # Embed patches x_rgb = self.rgb_embed(x_rgb) # (B, L, D) x_depth = self.depth_embed(x_depth) # (B, L, D) x_pc = self.pc_embed(x_pc) # (B, M, D) # Add positional embeddings x_rgb = x_rgb + self.pos_embed_2d x_depth = x_depth + self.pos_embed_2d x_pc = x_pc + self.pos_embed_pc # Add modality embeddings x_rgb = x_rgb + self.modality_embed_rgb x_depth = x_depth + self.modality_embed_depth x_pc = x_pc + self.modality_embed_pc # Masking using Dirichlet distribution (x_rgb_vis, x_depth_vis, x_pc_vis, mask_rgb, mask_depth, mask_pc, ids_restore_rgb, ids_restore_depth, ids_restore_pc) = self.random_masking_dirichlet( x_rgb, x_depth, x_pc, mask_ratio ) # Concatenate visible tokens from all modalities x = torch.cat([x_rgb_vis, x_depth_vis, x_pc_vis], dim=1) # Add cls token cls_token = self.cls_token.expand(x.shape[0], -1, -1) x = torch.cat([cls_token, x], dim=1) # Apply encoder blocks for block in self.encoder_blocks: x = block(x) x = self.encoder_norm(x) return (x, mask_rgb, mask_depth, mask_pc, ids_restore_rgb, ids_restore_depth, ids_restore_pc, x_rgb_vis.shape[1], x_depth_vis.shape[1], x_pc_vis.shape[1]) def forward_decoder(self, x, ids_restore_rgb, ids_restore_depth, ids_restore_pc, len_rgb, len_depth, len_pc): """ Forward pass through decoder """ # Embed tokens x = self.decoder_embed(x) # Remove cls token x_no_cls = x[:, 1:, :] # Split back into modalities x_rgb_vis = x_no_cls[:, :len_rgb] x_depth_vis = x_no_cls[:, len_rgb:len_rgb+len_depth] x_pc_vis = x_no_cls[:, len_rgb+len_depth:] # Add mask tokens for each modality B = x.shape[0] # RGB mask_tokens_rgb = self.mask_token.repeat(B, self.num_patches - len_rgb, 1) x_rgb_full = torch.cat([x_rgb_vis, mask_tokens_rgb], dim=1) x_rgb_full = torch.gather(x_rgb_full, dim=1, index=ids_restore_rgb.unsqueeze(-1).repeat(1, 1, x_rgb_full.shape[2])) # Depth mask_tokens_depth = self.mask_token.repeat(B, self.num_patches - len_depth, 1) x_depth_full = torch.cat([x_depth_vis, mask_tokens_depth], dim=1) x_depth_full = torch.gather(x_depth_full, dim=1, index=ids_restore_depth.unsqueeze(-1).repeat(1, 1, x_depth_full.shape[2])) # Point cloud mask_tokens_pc = self.mask_token.repeat(B, self.num_pc_tokens - len_pc, 1) x_pc_full = torch.cat([x_pc_vis, mask_tokens_pc], dim=1) x_pc_full = torch.gather(x_pc_full, dim=1, index=ids_restore_pc.unsqueeze(-1).repeat(1, 1, x_pc_full.shape[2])) # Add positional embeddings x_rgb_full = x_rgb_full + self.decoder_pos_embed_2d x_depth_full = x_depth_full + self.decoder_pos_embed_2d x_pc_full = x_pc_full + self.decoder_pos_embed_pc # Concatenate all tokens x = torch.cat([x_rgb_full, x_depth_full, x_pc_full], dim=1) # Apply decoder blocks for block in self.decoder_blocks: x = block(x) x = self.decoder_norm(x) # Split and predict for each modality x_rgb_dec = x[:, :self.num_patches] x_depth_dec = x[:, self.num_patches:2*self.num_patches] x_pc_dec = x[:, 2*self.num_patches:] pred_rgb = self.decoder_pred_rgb(x_rgb_dec) pred_depth = self.decoder_pred_depth(x_depth_dec) # Point cloud reconstruction with upsampling # x_pc_dec: (B, num_pc_tokens, decoder_embed_dim) - e.g., (B, 196, 512) # We need to upsample to (B, 2048, 3) B, N_tokens, _ = x_pc_dec.shape # Project to feature space pc_features = self.decoder_pc_proj(x_pc_dec) # (B, N_tokens, 512) # Generate 2D grid for folding operation # Each token will generate points_per_token points # Create a grid that can handle non-square numbers grid_size = int(np.ceil(np.sqrt(self.points_per_token))) # Round up to ensure enough points grid_1d = torch.linspace(-1, 1, grid_size, device=x_pc_dec.device) grid_y, grid_x = torch.meshgrid(grid_1d, grid_1d, indexing='ij') grid = torch.stack([grid_x, grid_y], dim=-1) # (grid_size, grid_size, 2) grid = grid.reshape(-1, 2)[:self.points_per_token] # Take exactly points_per_token points, (points_per_token, 2) grid = grid.unsqueeze(0).unsqueeze(0) # (1, 1, points_per_token, 2) grid = grid.expand(B, N_tokens, -1, -1) # (B, N_tokens, points_per_token, 2) # Expand features to match grid pc_features_expanded = pc_features.unsqueeze(2).expand(-1, -1, self.points_per_token, -1) # (B, N_tokens, points_per_token, 512) # Concatenate features with grid coordinates folding_input = torch.cat([pc_features_expanded, grid], dim=-1) # (B, N_tokens, points_per_token, 514) # Apply folding network to generate 3D points folding_input_flat = folding_input.reshape(B * N_tokens * self.points_per_token, -1) # (B*N_tokens*points_per_token, 514) pred_pc_flat = self.decoder_pc_fold(folding_input_flat) # (B*N_tokens*points_per_token, 3) pred_pc = pred_pc_flat.reshape(B, N_tokens * self.points_per_token, 3) # (B, 2048, 3) # Trim to exact target_points if needed (due to rounding) if pred_pc.shape[1] > self.target_points: pred_pc = pred_pc[:, :self.target_points, :] elif pred_pc.shape[1] < self.target_points: padding = self.target_points - pred_pc.shape[1] pred_pc = torch.cat([pred_pc, pred_pc[:, :padding, :]], dim=1) return pred_rgb, pred_depth, pred_pc def forward_loss(self, imgs_rgb, imgs_depth, pc, pred_rgb, pred_depth, pred_pc, mask_rgb, mask_depth, mask_pc): """ Compute reconstruction loss """ # RGB loss target_rgb = self.patchify(imgs_rgb, self.patch_size, imgs_rgb.shape[1]) if self.norm_pix_loss: mean = target_rgb.mean(dim=-1, keepdim=True) var = target_rgb.var(dim=-1, keepdim=True) target_rgb = (target_rgb - mean) / (var + 1.e-6)**.5 loss_rgb = (pred_rgb - target_rgb) ** 2 loss_rgb = loss_rgb.mean(dim=-1) loss_rgb = (loss_rgb * mask_rgb).sum() / mask_rgb.sum() # Depth loss — normalize TARGET only; model learns to predict normalized values target_depth = self.patchify(imgs_depth, self.patch_size, imgs_depth.shape[1])
if self.normalize_depth_global: B_d = target_depth.shape[0] N_d = target_depth.shape[1] target_flat = target_depth.reshape(B_d, -1)
if self.depth_norm_type == 'minmax': t_min = target_flat.min(dim=1, keepdim=True).values t_max = target_flat.max(dim=1, keepdim=True).values denom = (t_max - t_min).clamp(min=1e-6) target_flat = (target_flat - t_min) / denom elif self.depth_norm_type == 'standard': t_mean = target_flat.mean(dim=1, keepdim=True) t_std = target_flat.std(dim=1, keepdim=True).clamp(min=1e-6) target_flat = (target_flat - t_mean) / t_std
target_depth = target_flat.reshape(B_d, N_d, -1)
elif self.norm_pix_loss: mean = target_depth.mean(dim=-1, keepdim=True) var = target_depth.var(dim=-1, keepdim=True) target_depth = (target_depth - mean) / (var + 1.e-6)**.5 loss_depth = (pred_depth - target_depth) ** 2 loss_depth = loss_depth.mean(dim=-1) loss_depth = (loss_depth * mask_depth).sum() / mask_depth.sum() # Point cloud loss - batched Chamfer Distance loss_pc = chamfer_distance(pred_pc, pc) # Apply weight to point cloud loss to balance with RGB/Depth # Chamfer distance is naturally much smaller, so we scale it up loss_pc_weighted = loss_pc * self.pc_loss_weight total_loss = loss_rgb + loss_depth + loss_pc_weighted return total_loss, loss_rgb, loss_depth, loss_pc def patchify(self, imgs, patch_size, in_chans): """ imgs: (B, C, H, W) return: (B, L, patch_size**2 * C) """ p = patch_size h = w = imgs.shape[2] // p x = imgs.reshape(imgs.shape[0], in_chans, h, p, w, p) x = torch.einsum('nchpwq->nhwpqc', x) x = x.reshape(imgs.shape[0], h * w, p**2 * in_chans) return x def forward(self, imgs_rgb, imgs_depth, pc, mask_ratio=0.75): """ Forward pass Args: imgs_rgb: (B, 3, H, W) RGB images imgs_depth: (B, 1, H, W) Depth images pc: (B, N, 3) Point clouds mask_ratio: Masking ratio Returns: loss, pred, mask """ # Encoder (latent, mask_rgb, mask_depth, mask_pc, ids_restore_rgb, ids_restore_depth, ids_restore_pc, len_rgb, len_depth, len_pc) = self.forward_encoder( imgs_rgb, imgs_depth, pc, mask_ratio ) # Decoder pred_rgb, pred_depth, pred_pc = self.forward_decoder( latent, ids_restore_rgb, ids_restore_depth, ids_restore_pc, len_rgb, len_depth, len_pc ) # Loss loss, loss_rgb, loss_depth, loss_pc = self.forward_loss( imgs_rgb, imgs_depth, pc, pred_rgb, pred_depth, pred_pc, mask_rgb, mask_depth, mask_pc ) return loss, (loss_rgb, loss_depth, loss_pc), (pred_rgb, pred_depth, pred_pc), (mask_rgb, mask_depth, mask_pc)
def embodied_mae_small(**kwargs): model = EmbodiedMAE( embed_dim=384, depth=12, num_heads=6, decoder_embed_dim=192, decoder_depth=4, decoder_num_heads=3, mlp_ratio=4, **kwargs ) return model
def embodied_mae_base(**kwargs): model = EmbodiedMAE( embed_dim=768, depth=12, num_heads=12, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, mlp_ratio=4, **kwargs ) return model
def embodied_mae_large(**kwargs): model = EmbodiedMAE( embed_dim=1024, depth=24, num_heads=16, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, mlp_ratio=4, **kwargs ) return model
def embodied_mae_giant(**kwargs): model = EmbodiedMAE( embed_dim=1408, depth=40, num_heads=16, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, mlp_ratio=4, **kwargs ) return model
if __name__ == "__main__": # Test the model device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') model = embodied_mae_base() model = model.to(device) # Dummy data rgb = torch.randn(2, 3, 224, 224).to(device) depth = torch.randn(2, 1, 224, 224).to(device) pc = torch.randn(2, 2048, 3).to(device) # Forward pass loss, (loss_rgb, loss_depth, loss_pc), preds, masks = model(rgb, depth, pc) print(f"Total Loss: {loss.item():.4f}") print(f"RGB Loss: {loss_rgb.item():.4f}") print(f"Depth Loss: {loss_depth.item():.4f}") print(f"PC Loss: {loss_pc.item():.4f}") # Count parameters total_params = sum(p.numel() for p in model.parameters()) trainable_params = sum(p.numel() for p in model.parameters() if p.requires_grad) print(f"\nTotal Parameters: {total_params:,}") print(f"Trainable Parameters: {trainable_params:,}")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191"""EmbodiedMAE-4M: RGB + Depth + PointCloud + Spline Parameters
Spline / parameter modality (encoder → decoder design): ENCODER INPUT : N_PARAMS-dim float vector per token → ParamEmbed (Linear → GELU → LayerNorm) DECODER OUTPUT : direct float regression of the same numeric values (Smooth-L1 loss, all params normalised to [0, 1]) DISPLAY : predicted floats are un-normalised and formatted as text for visualisation only (decode_params_to_text)
Parameter layout (N_PARAMS = 9 per token): Plant token (idx 0) : [sl, sd_x, sd_y, sd_z, ps_x, ps_y, ps_z, pa, pr] Leaf token (idx 1+): [sp, ln, ra, ba, wd, 0, 0, 0, 0 ] All values normalised to [0, 1] — see _PLANT_SCALE / _LEAF_SCALE below."""
import math
import numpy as npimport torchimport torch.nn as nnimport torch.nn.functional as F
from pc_sinkhorn import sinkhorn_pc_lossfrom embodied_mae import ( PatchEmbed, PointCloudEmbed, TransformerBlock, get_2d_sincos_pos_embed, chamfer_distance, qal_loss, earth_movers_distance,)
# ── Numeric parameter layout ──────────────────────────────────────────────────
N_PARAMS = 9 # fixed-size float vector per token
# Canonical modality order. Token layout, loss order and state_dict keys all# follow it, so an arm's layout never depends on the order the caller wrote# active_modalities in. Same vocabulary as train_sorghum_4m_distill.py:83.MODALITIES = ('rgb', 'depth', 'pc', 'text')
# norm = (raw + shift) / scale → raw = norm * scale - shift# All outputs land in [0, 1] for the expected data ranges._PLANT_SCALE = np.array([3.0, 2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 50.0, 0.02], np.float32)_PLANT_SHIFT = np.array([0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0], np.float32)# [sl, sdx, sdy, sdz, psx, psy, psz, pa, pr ]
# Leaf fields since the 2026-09-30 spline rewrite (shorgum_data/add_leaf_width.py):# waviness_frequency and waviness_period_start were removed from every# *_spline.yml and a per-leaf blade `width` (metres, max margin-to-margin distance# on the mesh, 0.046-0.148 over all 292,082 leaves) was added. Runs before that# date used [sp, ln, ra, ba, wf, wp0, wp1, 0, 0] and cannot be rebuilt from the# current files.# The length scale was 1.0 until then, which clipped the 0.54 % of leaves longer# than 1.0 (max 1.125, 1,504 of 15,000 plants); 1.25 keeps every leaf in range.LEAF_FIELDS = ('starting_point', 'length', 'roll_angle', 'branching_angle', 'width')_LEAF_SCALE = np.array([1.0, 1.25, 360.0, 180.0, 0.2, 1.0, 1.0, 1.0, 1.0], np.float32)_LEAF_SHIFT = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], np.float32)# [sp, ln, ra, ba, wd, (unused×4)]
def _plant_to_params(plant: dict) -> np.ndarray: p = plant['Parameters'] sd = p['stem_direction'] ps = p['panicle_size'] raw = np.array([ float(p['stem_length']), float(sd[0]), float(sd[1]), float(sd[2]), float(ps[0]), float(ps[1]), float(ps[2]), float(p['panicle_seed_amount']), float(p['panicle_seed_radius']), ], dtype=np.float32) return np.clip((raw + _PLANT_SHIFT) / _PLANT_SCALE, 0.0, 1.0)
def _leaf_to_params(leaf: dict) -> np.ndarray: n = len(LEAF_FIELDS) raw = np.array([float(leaf[k]) for k in LEAF_FIELDS], dtype=np.float32) norm = np.clip((raw + _LEAF_SHIFT[:n]) / _LEAF_SCALE[:n], 0.0, 1.0) return np.concatenate([norm, np.zeros(N_PARAMS - n, np.float32)]) # pad to N_PARAMS
def _params_to_plant_text(params: np.ndarray) -> str: p = np.clip(params, 0.0, 1.0) raw = p * _PLANT_SCALE - _PLANT_SHIFT sl, sdx, sdy, sdz, psx, psy, psz, pa, pr = raw return (f"sl={sl:.4f} sd={sdx:+.3f},{sdy:+.3f},{sdz:+.3f} " f"ps={psx:.3f},{psy:.3f},{psz:.3f} pa={int(round(pa))} pr={pr:.4f}")
def _params_to_leaf_text(params: np.ndarray) -> str: n = len(LEAF_FIELDS) p = np.clip(params[:n], 0.0, 1.0) sp, ln, ra, ba, wd = p * _LEAF_SCALE[:n] - _LEAF_SHIFT[:n] return (f"sp={sp:.4f} ln={ln:.4f} ra={ra:06.2f} ba={ba:06.2f} wd={wd:.4f}")
def _bounded_proportional_allocation(total, weights, lower, upper): """Allocate an integer total proportionally while respecting bounds.
The continuous allocation is a capped water-filling solution. Largest remainders then convert it to integers without changing ``total``. This is deliberately a pure-Python helper: modality counts are shared by the whole batch, tiny, and easy to unit-test independently of model construction. """ n_items = len(weights) if n_items == 0 or len(lower) != n_items or len(upper) != n_items: raise ValueError("weights, lower, and upper must have the same non-zero length") if not isinstance(total, int) or isinstance(total, bool): raise TypeError("total must be an integer") if any(not isinstance(value, int) or isinstance(value, bool) for value in (*lower, *upper)): raise TypeError("allocation bounds must be integers") if any(lo < 0 or hi < lo for lo, hi in zip(lower, upper)): raise ValueError("allocation bounds must satisfy 0 <= lower <= upper") if total < sum(lower) or total > sum(upper): raise ValueError("total is outside the feasible allocation bounds")
weights = tuple(float(value) for value in weights) if any(not math.isfinite(value) or value < 0 for value in weights): raise ValueError("allocation weights must be finite and non-negative") if sum(weights) <= 0: raise ValueError("at least one allocation weight must be positive")
continuous = [float(value) for value in lower] remaining = float(total - sum(lower)) active = {index for index, (lo, hi) in enumerate(zip(lower, upper)) if lo < hi}
# Redistribute the share of every saturated item across all items that # still have capacity. Zero-weight survivors use a uniform fallback once # all positive-weight items have saturated. while remaining > 1e-12: if not active: raise RuntimeError("allocation exhausted capacity before reaching total") active_weight = sum(weights[index] for index in active) if active_weight > 0: shares = { index: remaining * weights[index] / active_weight for index in active } else: uniform_share = remaining / len(active) shares = {index: uniform_share for index in active}
saturated = [ index for index in active if shares[index] >= upper[index] - continuous[index] - 1e-12 ] if saturated: for index in saturated: capacity = upper[index] - continuous[index] continuous[index] = float(upper[index]) remaining -= capacity active.remove(index) remaining = max(remaining, 0.0) else: for index in active: continuous[index] += shares[index] remaining = 0.0
allocation = [int(math.floor(value)) for value in continuous] remainder = total - sum(allocation) while remainder > 0: candidates = [index for index in range(n_items) if allocation[index] < upper[index]] if not candidates: raise RuntimeError("integer allocation exhausted capacity") index = max( candidates, key=lambda item: ( continuous[item] - allocation[item], weights[item], -item, ), ) allocation[index] += 1 remainder -= 1
return tuple(allocation)
def _visible_token_counts(lengths, weights, mask_ratio_total, min_mask_ratio=0.25): """Return bounded visible-token counts whose sum matches the global ratio.
At least one token stays visible in every modality. ``min_mask_ratio`` is treated as a per-modality upper bound on visibility whenever those bounds can accommodate the requested global total. If they cannot, the minimum masking constraint is relaxed only by the unavoidable overflow, which is redistributed according to ``weights``. """ lengths = tuple(lengths) if not lengths: raise ValueError("at least one modality is required") if any(not isinstance(length, int) or isinstance(length, bool) or length <= 0 for length in lengths): raise ValueError("all modality lengths must be positive integers") if len(weights) != len(lengths): raise ValueError("weights and modality lengths must have the same length")
try: mask_ratio_total = float(mask_ratio_total) min_mask_ratio = float(min_mask_ratio) except (TypeError, ValueError) as exc: raise TypeError("mask ratios must be real numbers") from exc if not math.isfinite(mask_ratio_total) or not 0.0 <= mask_ratio_total <= 1.0: raise ValueError("mask_ratio_total must be finite and in [0, 1]") if not math.isfinite(min_mask_ratio) or not 0.0 <= min_mask_ratio <= 1.0: raise ValueError("min_mask_ratio must be finite and in [0, 1]")
total_tokens = sum(lengths) # Preserve the model's existing floor convention for a fractional token. total_visible = int(math.floor(total_tokens * (1.0 - mask_ratio_total))) minimum_visible = len(lengths) if total_visible < minimum_visible: raise ValueError( f"mask_ratio_total leaves {total_visible} visible tokens, but at " f"least {minimum_visible} are required to keep one per modality" )
lower = (1,) * len(lengths) constrained_upper = tuple( max(1, int(math.floor( length * (1.0 - min_mask_ratio) + 1e-12 ))) for length in lengths )
if total_visible <= sum(constrained_upper): upper = constrained_upper allocation_lower = lower else: # The global ratio has priority. Starting at every constrained upper # bound makes the amount of min-mask relaxation exactly the unavoidable # overflow, rather than relaxing a modality that could stay bounded. # Keep at least one reconstruction target per modality whenever the # global budget contains enough masked tokens to do so. Besides being # a better MAE objective, this prevents empty masked-loss denominators. total_masked = total_tokens - total_visible if total_masked >= len(lengths) and all(length > 1 for length in lengths): upper = tuple(length - 1 for length in lengths) else: upper = lengths allocation_lower = constrained_upper
return _bounded_proportional_allocation( total_visible, weights, allocation_lower, upper)
# ── Data loading ──────────────────────────────────────────────────────────────
def load_spline_params(yml_path, max_leaves: int = 24): """Parse a spline YAML into: valid : (1+max_leaves,) float32 — 1=real token, 0=pad param_floats : (1+max_leaves, N_PARAMS) float32 — encoder input + target """ import yaml # The spline YAMLs are ~258 KB and get re-parsed on every __getitem__, which # made pure-python yaml.safe_load the single largest cost in the whole data # pipeline (~729 ms/sample vs ~11 ms for the point cloud). libyaml's C loader # parses the same documents ~8.6x faster; fall back if it is unavailable. try: from yaml import CSafeLoader as _Loader except ImportError: _Loader = yaml.SafeLoader with open(yml_path) as f: data = yaml.load(f, Loader=_Loader)
plant = data['Sorghums'][0] # Some leaves are geometry-only (Center/Left/Right Points but no procedural # params) — skip them so they don't become param tokens and crash _leaf_to_params. # A plant whose leaves ALL fail the check is an error, not a plant with no # leaves: that is what a spline file of the other format looks like (before the # width rewrite this filter required the waviness keys, and against today's # files it would have dropped every leaf token without a word). leaves = [lf for lf in plant['Leaves'] if all(k in lf for k in LEAF_FIELDS)] if plant['Leaves'] and not leaves: lacks = sorted(set(LEAF_FIELDS) - set(plant['Leaves'][0])) raise ValueError(f"{yml_path}: no leaf has all of {LEAF_FIELDS} (the first " f"lacks {lacks}); is this a spline file from before the " f"width rewrite?")
n_tokens = 1 + max_leaves valid = np.zeros(n_tokens, dtype=np.float32) param_floats = np.zeros((n_tokens, N_PARAMS), dtype=np.float32)
valid[0] = 1.0 param_floats[0] = _plant_to_params(plant)
for i, leaf in enumerate(leaves[:max_leaves]): valid[1 + i] = 1.0 param_floats[1 + i] = _leaf_to_params(leaf)
return torch.from_numpy(valid), torch.from_numpy(param_floats)
# ── Param embedder (encoder input) ───────────────────────────────────────────
class ParamEmbed(nn.Module): """Embed an N_PARAMS-dim float vector per token into the shared embed space. Pipeline: floats → Linear → GELU → LayerNorm. """
def __init__(self, n_params: int = N_PARAMS, embed_dim: int = 768): super().__init__() self.proj = nn.Linear(n_params, embed_dim) self.act = nn.GELU() self.norm = nn.LayerNorm(embed_dim)
def forward(self, params: torch.Tensor) -> torch.Tensor: """params : (B, n_tokens, N_PARAMS) → (B, n_tokens, D)""" return self.norm(self.act(self.proj(params)))
# ── Main model ────────────────────────────────────────────────────────────────
class EmbodiedMAE4M(nn.Module): """Multi-modal MAE: RGB | Depth | PointCloud | Parametric.
Param modality: encoder reads N_PARAMS-dim float vector per token (ParamEmbed) decoder predicts N_PARAMS float values per masked token (Smooth-L1) at display time floats are formatted back to human-readable text """
def __init__( self, img_size: int = 224, patch_size: int = 16, in_chans_rgb: int = 3, in_chans_depth: int = 1, num_pc_tokens: int = 196, pc_group_size: int = 32, target_points: int = 10000, pc_loss_weight: float = 50.0, max_leaves: int = 24, spline_loss_weight: float = 5.0, embed_dim: int = 768, depth: int = 12, num_heads: int = 12, decoder_embed_dim: int = 512, decoder_depth: int = 8, decoder_num_heads: int = 16, mlp_ratio: float = 4.0, norm_pix_loss: bool = True, dirichlet_alpha: float = 1.0, depth_norm_type: str = 'minmax', pc_loss_name: str = 'chamfer', qal_threshold: float = 0.01, qal_alpha: float = 100.0, qal_use_squared: bool = False, pc_sinkhorn_weight: float = 0.0, pc_sinkhorn_points: int = 2048, pc_sinkhorn_blur: float = 0.01, active_modalities=None, text_mask_ratio=None, ): super().__init__()
# ── Modality gate (E2 ablation) ─────────────────────────────────── # `active_modalities` selects which token streams exist AT ALL. An # inactive modality gets no embedder, no modality/positional embedding, # no decoder head and no loss term — it is absent, not merely masked. # # Why absent rather than masked: forcing a modality to zero visible # tokens still reconstructs it (forward_decoder restores every position # from mask tokens) and still adds its term to `total`, so a "PC-only" # model would keep learning the spline params and the ablation would # measure nothing. Zero-length slices also produce zero-valued grads # rather than None, so AdamW would go on weight-decaying a dead # embedder. That masked-but-present path is cross-modal distillation, # which is what forward_encoder_select / `visible=` are for. # # Default None == all four, and that path is bit-identical to the # pre-gate model, so existing checkpoints load unchanged. if active_modalities is None: active_modalities = MODALITIES active = tuple(str(m).lower() for m in active_modalities) unknown = [m for m in active if m not in MODALITIES] if unknown: raise ValueError( f"unknown modality/modalities {unknown}; " f"expected a subset of {list(MODALITIES)}") if len(set(active)) != len(active): raise ValueError(f"duplicate entries in active_modalities: {active}") if not active: raise ValueError("active_modalities must name at least one modality") if 'pc' not in active: # Every E2 arm is PC-anchored, and the PC loss is the only term # computed over the whole cloud rather than over masked tokens. raise ValueError("'pc' must be active: it anchors the reconstruction target") # Normalise to canonical order so the token layout never depends on the # order the caller happened to write the list in. self.active_modalities = tuple(m for m in MODALITIES if m in active) self.n_active = len(self.active_modalities) self.text_mask_ratio = text_mask_ratio
self.img_size = img_size self.patch_size = patch_size self.num_patches = (img_size // patch_size) ** 2 self.num_pc_tokens = num_pc_tokens self.max_leaves = max_leaves self.n_text_tokens = 1 + max_leaves self.embed_dim = embed_dim self.norm_pix_loss = norm_pix_loss self.dirichlet_alpha = dirichlet_alpha self.pc_loss_weight = pc_loss_weight self.spline_loss_weight = spline_loss_weight self.depth_norm_type = depth_norm_type # 'chamfer_cdist': chamfer_distance's formula through torch.cdist; # 'sinkhorn': no nearest-neighbour term, the Sinkhorn term alone. # (Both ported from the loss-study branch, 2026-10-14, with pc_sinkhorn_*.) if pc_loss_name not in {'chamfer', 'chamfer_cdist', 'qal_loss', 'sinkhorn'}: raise ValueError( f"Unsupported point-cloud loss {pc_loss_name!r}; " "expected 'chamfer', 'chamfer_cdist', 'qal_loss' or 'sinkhorn'") if pc_loss_name == 'sinkhorn' and not pc_sinkhorn_weight > 0: raise ValueError("pc_loss_name 'sinkhorn' needs pc_sinkhorn_weight > 0") if qal_threshold < 0: raise ValueError("qal_threshold must be non-negative") if qal_alpha <= 0: raise ValueError("qal_alpha must be positive") self.pc_loss_name = pc_loss_name self.qal_threshold = qal_threshold self.qal_alpha = qal_alpha self.qal_use_squared = qal_use_squared # Optional Sinkhorn term added to the PC loss (pc_sinkhorn.py); 0 = off, # which is every run before 2026-10-14 and never imports geomloss. if pc_sinkhorn_weight < 0 or pc_sinkhorn_points < 2 or pc_sinkhorn_blur <= 0: raise ValueError('pc_sinkhorn_weight >= 0, pc_sinkhorn_points >= 2 and ' 'pc_sinkhorn_blur > 0 are required') self.pc_sinkhorn_weight = float(pc_sinkhorn_weight) self.pc_sinkhorn_points = int(pc_sinkhorn_points) self.pc_sinkhorn_blur = float(pc_sinkhorn_blur) self.target_points = target_points self.points_per_token = target_points // num_pc_tokens
# Token count per modality — the single source of truth for every layout # computation below (encoder cat, decoder restore, head split). self._token_len = { 'rgb': self.num_patches, 'depth': self.num_patches, 'pc': num_pc_tokens, 'text': self.n_text_tokens, }
# ── Embedders (active modalities only) ──────────────────────────── # Attribute NAMES are unchanged so state_dict keys match the pre-gate # model; an inactive modality simply contributes no keys. act = self.active_modalities self.rgb_embed = (PatchEmbed(img_size, patch_size, in_chans_rgb, embed_dim) if 'rgb' in act else None) self.depth_embed = (PatchEmbed(img_size, patch_size, in_chans_depth, embed_dim) if 'depth' in act else None) self.pc_embed = (PointCloudEmbed(num_pc_tokens, pc_group_size, embed_dim) if 'pc' in act else None) self.param_embed = (ParamEmbed(N_PARAMS, embed_dim) if 'text' in act else None)
# ── Modality embeddings ─────────────────────────────────────────── def _mod_embed(name): return (nn.Parameter(torch.zeros(1, 1, embed_dim)) if name in act else None) self.modality_embed_rgb = _mod_embed('rgb') self.modality_embed_depth = _mod_embed('depth') self.modality_embed_pc = _mod_embed('pc') self.modality_embed_text = _mod_embed('text')
# ── Positional embeddings ───────────────────────────────────────── # pos_embed_2d is SHARED by rgb and depth, so it exists if either does. self._needs_2d = ('rgb' in act) or ('depth' in act) self.pos_embed_2d = (nn.Parameter( torch.zeros(1, self.num_patches, embed_dim), requires_grad=False) if self._needs_2d else None) self.pos_embed_pc = (nn.Parameter( torch.zeros(1, num_pc_tokens, embed_dim), requires_grad=True) if 'pc' in act else None) self.pos_embed_text = (nn.Parameter( torch.zeros(1, self.n_text_tokens, embed_dim), requires_grad=True) if 'text' in act else None)
self.cls_token = nn.Parameter(torch.zeros(1, 1, embed_dim))
# ── Encoder ─────────────────────────────────────────────────────── self.encoder_blocks = nn.ModuleList([ TransformerBlock(embed_dim, num_heads, mlp_ratio, qkv_bias=True) for _ in range(depth) ]) self.encoder_norm = nn.LayerNorm(embed_dim)
# ── Decoder ─────────────────────────────────────────────────────── self.decoder_embed = nn.Linear(embed_dim, decoder_embed_dim, bias=True) self.mask_token = nn.Parameter(torch.zeros(1, 1, decoder_embed_dim))
self.decoder_pos_embed_2d = (nn.Parameter( torch.zeros(1, self.num_patches, decoder_embed_dim), requires_grad=False) if self._needs_2d else None) self.decoder_pos_embed_pc = (nn.Parameter( torch.zeros(1, num_pc_tokens, decoder_embed_dim), requires_grad=False) if 'pc' in act else None) self.decoder_pos_embed_text = (nn.Parameter( torch.zeros(1, self.n_text_tokens, decoder_embed_dim), requires_grad=False) if 'text' in act else None)
self.decoder_blocks = nn.ModuleList([ TransformerBlock(decoder_embed_dim, decoder_num_heads, mlp_ratio, qkv_bias=True) for _ in range(decoder_depth) ]) self.decoder_norm = nn.LayerNorm(decoder_embed_dim)
# ── Prediction heads (active modalities only) ───────────────────── self.decoder_pred_rgb = ( nn.Linear(decoder_embed_dim, patch_size**2 * in_chans_rgb) if 'rgb' in act else None) self.decoder_pred_depth = ( nn.Linear(decoder_embed_dim, patch_size**2 * in_chans_depth) if 'depth' in act else None)
# Param head: 2-layer MLP — produces N_PARAMS normalised floats per token self.decoder_pred_params = (nn.Sequential( nn.Linear(decoder_embed_dim, decoder_embed_dim), nn.GELU(), nn.LayerNorm(decoder_embed_dim), nn.Linear(decoder_embed_dim, N_PARAMS), ) if 'text' in act else None)
# PC folding decoder self.decoder_pc_proj = (nn.Linear(decoder_embed_dim, 512) if 'pc' in act else None) self.decoder_pc_fold = (nn.Sequential( nn.Linear(514, 512), nn.ReLU(), nn.Linear(512, 512), nn.ReLU(), nn.Linear(512, 3), ) if 'pc' in act else None)
self.initialize_weights()
# ── Weights ───────────────────────────────────────────────────────────────
def initialize_weights(self): # pos_embed_2d / decoder_pos_embed_2d exist only if rgb or depth is active. if self.pos_embed_2d is not None: pos_2d = get_2d_sincos_pos_embed(self.embed_dim, int(self.num_patches ** .5)) self.pos_embed_2d.data.copy_(torch.from_numpy(pos_2d).float().unsqueeze(0))
dec_dim = self.decoder_blocks[0].norm1.normalized_shape[0] dec_2d = get_2d_sincos_pos_embed(dec_dim, int(self.num_patches ** .5)) self.decoder_pos_embed_2d.data.copy_( torch.from_numpy(dec_2d).float().unsqueeze(0))
for p in (self.pos_embed_pc, self.pos_embed_text, self.decoder_pos_embed_pc, self.decoder_pos_embed_text): if p is not None: nn.init.normal_(p, std=.02) for e in (self.modality_embed_rgb, self.modality_embed_depth, self.modality_embed_pc, self.modality_embed_text): if e is not None: nn.init.normal_(e, std=.02) nn.init.normal_(self.cls_token, std=.02) nn.init.normal_(self.mask_token, std=.02) self.apply(self._init_weights)
def _init_weights(self, m): if isinstance(m, nn.Linear): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bias, 0) elif isinstance(m, nn.LayerNorm): nn.init.constant_(m.bias, 0) nn.init.constant_(m.weight, 1.0)
# ── Dirichlet masking ─────────────────────────────────────────────────────
def _embed_active(self, x_rgb, x_depth, x_pc, x_param): """Embed ONLY the active modalities -> {name: (B, L, D)}.
An inactive modality is not embedded at all (its embedder is None), so a reduced arm costs what it should instead of computing and discarding. """ out = {} if 'rgb' in self.active_modalities: out['rgb'] = (self.rgb_embed(x_rgb) + self.pos_embed_2d + self.modality_embed_rgb) if 'depth' in self.active_modalities: out['depth'] = (self.depth_embed(x_depth) + self.pos_embed_2d + self.modality_embed_depth) if 'pc' in self.active_modalities: out['pc'] = (self.pc_embed(x_pc) + self.pos_embed_pc + self.modality_embed_pc) if 'text' in self.active_modalities: out['text'] = (self.param_embed(x_param) + self.pos_embed_text + self.modality_embed_text) return out
def random_masking_dirichlet(self, embeds, mask_ratio_total=0.75, min_mask_ratio=0.25): """Mask random positions with an exact, bounded global token budget.
`embeds` is the {name: (B, L, D)} dict from _embed_active. One Dirichlet draw allocates visible-token counts across the ACTIVE modalities for the batch; positions are shuffled independently for every sample.
When `self.text_mask_ratio` is not None the text stream is taken out of the Dirichlet and masked independently at that rate. Reason: text is 25 tokens against 196 per vision stream, and one length-agnostic global budget hands it a disproportionate share. Measured over 4000 draws at mask_ratio 0.80, the four-modality arm came out text 59% visible while its vision streams fell from 20% to 18% -- distorting the +params arm in both directions at once (an easier param pretext task AND fewer vision tokens than the PC+RGB+D arm it is compared against). Splitting the budget puts every stream at 20%, and leaves arms without text bit-identical to the pre-gate model.
Returns {name: (x_vis, mask, ids_rest)} for the active modalities. """ names = self.active_modalities missing = [n for n in names if n not in embeds] if missing: raise KeyError(f"embeds is missing active modalities {missing}")
first = embeds[names[0]] B, _, embed_dim = first.shape device, dtype = first.device, first.dtype for name in names: t = embeds[name] if not isinstance(t, torch.Tensor): raise TypeError(f"embeds[{name!r}] must be a torch.Tensor") if t.ndim != 3: raise ValueError( f"embeds[{name!r}] must have shape (B, L, D), got {tuple(t.shape)}") if t.shape[0] != B: raise ValueError("all modalities must have the same batch size") if t.shape[2] != embed_dim: raise ValueError("all modalities must have the same embedding dimension") if t.device != device: raise ValueError("all modalities must be on the same device") if t.dtype != dtype: raise ValueError("all modalities must have the same dtype") if t.shape[1] <= 0: raise ValueError(f"embeds[{name!r}] has no tokens")
split_text = self.text_mask_ratio is not None and 'text' in names budget_names = tuple(n for n in names if not (split_text and n == 'text'))
lengths = tuple(embeds[n].shape[1] for n in budget_names) alpha = torch.full((len(budget_names),), self.dirichlet_alpha) proportions = torch.distributions.Dirichlet(alpha).sample().tolist() counts = _visible_token_counts( lengths, proportions, mask_ratio_total, min_mask_ratio) nv = dict(zip(budget_names, counts))
if split_text: L_text = embeds['text'].shape[1] # Same floor convention as _visible_token_counts, and never zero: a # text stream with no visible tokens is a different pretext task. # +1e-12 matches the convention in _visible_token_counts' upper # bound. Without it, 1.0-0.80 == 0.19999999999999996 in binary # float, so 25 tokens at text_mask_ratio 0.80 floors to 4 visible # rather than 5 — an off-by-one that is 20% of this short stream. nv['text'] = max(1, int(math.floor( L_text * (1.0 - self.text_mask_ratio) + 1e-12))) # text_mask_ratio >= 1.0 is the one deliberate exception: parameters # as a reconstruction TARGET only, never an encoder input. max(1, ...) # would otherwise leave one random token visible, and 1 time in 25 # that is the plant token carrying stem_length (the height target) # verbatim. param_embed still receives a (zero) gradient through the # empty gather, so DDP with find_unused_parameters=False is unaffected # (checked: no parameter has grad None at 1.0). if self.text_mask_ratio >= 1.0: nv['text'] = 0
def _mask(x, nv_, L_): noise = torch.rand(B, L_, device=x.device) ids_shuf = torch.argsort(noise, dim=1) ids_rest = torch.argsort(ids_shuf, dim=1) ids_keep = ids_shuf[:, :nv_] x_vis = torch.gather(x, 1, ids_keep.unsqueeze(-1).expand(-1, -1, x.shape[2])) mask = torch.ones(B, L_, device=x.device) mask[:, :nv_] = 0 mask = torch.gather(mask, 1, ids_rest) return x_vis, mask, ids_rest
return {n: _mask(embeds[n], nv[n], embeds[n].shape[1]) for n in names}
# -- Encoder ---------------------------------------------------------------
def _run_encoder(self, parts): """Concatenate visible tokens (canonical order) + CLS, run the trunk.""" x = torch.cat(parts, dim=1) cls = self.cls_token.expand(x.shape[0], -1, -1) x = torch.cat([cls, x], dim=1) for blk in self.encoder_blocks: x = blk(x) return self.encoder_norm(x)
def _pack(self, per_mod, latent): """Pack per-modality (mask, ids_rest, n_vis) into the legacy 13-tuple.
Inactive modalities yield None / 0 so the positional signature that generate_crossmodal.py:99 and train_sorghum_4m_distill.py rely on keeps working unchanged. """ m = tuple(per_mod[n][1] if n in per_mod else None for n in MODALITIES) r = tuple(per_mod[n][2] if n in per_mod else None for n in MODALITIES) lv = tuple(per_mod[n][0].shape[1] if n in per_mod else 0 for n in MODALITIES) return (latent,) + m + r + lv
def forward_encoder(self, x_rgb, x_depth, x_pc, x_param, mask_ratio=0.75): embeds = self._embed_active(x_rgb, x_depth, x_pc, x_param) masked = self.random_masking_dirichlet(embeds, mask_ratio) latent = self._run_encoder([masked[n][0] for n in self.active_modalities]) return self._pack(masked, latent)
# -- Encoder with explicit modality visibility (cross-modal) ---------------
def forward_encoder_select(self, x_rgb, x_depth, x_pc, x_param, visible, source_mask_ratio=0.0): """Encoder where each ACTIVE modality is EITHER fully visible OR fully masked (0 visible tokens), instead of Dirichlet token-level masking.
`visible` : iterable subset of the active modalities. Those keep all their tokens; the rest contribute 0 encoder tokens and are entirely reconstructed by the decoder. This is the training-time analogue of generate_crossmodal.py's probe, and the probe path for E2 -- an arm is probed with visible = {rgb, depth, pc} & arm, never text, so no arm reads the parameter stream at probe time.
`source_mask_ratio` : 0.0 (default) keeps the historical behaviour -- a visible modality is handed over WHOLE, every token, and its own reconstruction loss is identically zero because nothing of it is masked. Above 0.0, the visible modalities are additionally masked at the token level at that rate, so the student must infer the absent modalities from a PARTIAL source. This makes the cross-modal task strictly harder and matches how the model is probed at evaluation time (the RGB mask sweep blanks 0-95% of RGB patches). The masked source tokens also become real reconstruction targets, so the source's own loss stops being 0.
Returns the same 13-tuple as forward_encoder. mask_* is 1 everywhere for a fully masked modality, 0 everywhere for a fully visible one, and a genuine per-token 0/1 mask for a visible modality when source_mask_ratio > 0. None for inactive modalities. """ if not 0.0 <= float(source_mask_ratio) < 1.0: raise ValueError( f"source_mask_ratio must be in [0, 1), got {source_mask_ratio}") visible = set(visible) unknown = visible - set(self.active_modalities) if unknown: raise ValueError( f"visible names {sorted(unknown)} are not active modalities " f"{list(self.active_modalities)}")
embeds = self._embed_active(x_rgb, x_depth, x_pc, x_param) first = embeds[self.active_modalities[0]] B, dev = first.shape[0], first.device
def _sel(name): e = embeds[name] L = e.shape[1] if name not in visible: ids_rest = torch.arange(L, device=dev).unsqueeze(0).expand(B, L) return e[:, :0], torch.ones(B, L, device=dev), ids_rest if source_mask_ratio <= 0.0: ids_rest = torch.arange(L, device=dev).unsqueeze(0).expand(B, L) return e, torch.zeros(B, L, device=dev), ids_rest # Token-level masking of a VISIBLE source. Same construction as # random_masking_dirichlet._mask so the two regimes agree; +1e-12 # for the same binary-float floor reason, and at least one token # survives so the encoder never sees an empty source. n_keep = max(1, int(math.floor(L * (1.0 - source_mask_ratio) + 1e-12))) noise = torch.rand(B, L, device=dev) ids_shuf = torch.argsort(noise, dim=1) ids_rest = torch.argsort(ids_shuf, dim=1) ids_keep = ids_shuf[:, :n_keep] x_vis = torch.gather(e, 1, ids_keep.unsqueeze(-1).expand(-1, -1, e.shape[2])) mask = torch.ones(B, L, device=dev) mask[:, :n_keep] = 0 mask = torch.gather(mask, 1, ids_rest) return x_vis, mask, ids_rest
per_mod = {n: _sel(n) for n in self.active_modalities} latent = self._run_encoder([per_mod[n][0] for n in self.active_modalities]) return self._pack(per_mod, latent) # ── Decoder ───────────────────────────────────────────────────────────────
def forward_decoder(self, x, rr, rd, rp, rt, lr_, ld_, lp_, lt_, return_features=False): """Restore masked positions and predict, for ACTIVE modalities only.
The signature is positional and unchanged so generate_crossmodal.py:99 and train_sorghum_4m_distill.py keep working; entries belonging to an inactive modality are ignored (pass None / 0). An inactive modality's prediction comes back as None. """ ids_rest = {'rgb': rr, 'depth': rd, 'pc': rp, 'text': rt} n_vis = {'rgb': lr_, 'depth': ld_, 'pc': lp_, 'text': lt_} act = self.active_modalities
x = self.decoder_embed(x) x_nc = x[:, 1:, :] B = x.shape[0]
# Slice the encoder output back into per-modality visible blocks by # walking the active modalities in canonical order. This replaces the # old fixed rgb|depth|pc|text offsets, which assumed all four existed. vis = {} off = 0 for name in act: k = n_vis[name] if k is None: raise ValueError(f"n_vis for active modality {name!r} is None") vis[name] = x_nc[:, off: off + k] off += k
def _restore(x_vis, rest, n_tok): pad = self.mask_token.repeat(B, n_tok - x_vis.shape[1], 1) x_full = torch.cat([x_vis, pad], dim=1) return torch.gather(x_full, 1, rest.unsqueeze(-1).expand(-1, -1, x_full.shape[2]))
dec_pos = {'rgb': self.decoder_pos_embed_2d, 'depth': self.decoder_pos_embed_2d, 'pc': self.decoder_pos_embed_pc, 'text': self.decoder_pos_embed_text}
parts = [] for name in act: rest = ids_rest[name] if rest is None: raise ValueError(f"ids_rest for active modality {name!r} is None") parts.append(_restore(vis[name], rest, self._token_len[name]) + dec_pos[name])
x = torch.cat(parts, dim=1) for blk in self.decoder_blocks: x = blk(x) x = self.decoder_norm(x)
# Token-aligned decoder features (B, L_total, decoder_dim). The layout is # the ACTIVE modalities in canonical order and is IDENTICAL regardless of # which tokens were masked -- so these line up position-for-position # between any two forward passes of the SAME arm (e.g. a full-modal # teacher and a single-modal student). Used as the feature-distillation # target. NOTE: features are only comparable between models sharing the # same active_modalities, since the layout follows it. feats = x
# Per-modality token spans in the decoder sequence. span = {} off = 0 for name in act: L = self._token_len[name] span[name] = (off, off + L) off += L
def _slice(name): a, b = span[name] return x[:, a:b]
pred_rgb = pred_depth = pred_pc = pred_params = None
if 'rgb' in act: pred_rgb = self.decoder_pred_rgb(_slice('rgb')) if 'depth' in act: pred_depth = self.decoder_pred_depth(_slice('depth')) if 'text' in act: pred_params = self.decoder_pred_params(_slice('text'))
if 'pc' in act: x_pc_dec = _slice('pc') B2, N_tok, _ = x_pc_dec.shape pc_feat = self.decoder_pc_proj(x_pc_dec) gs = int(np.ceil(np.sqrt(self.points_per_token))) g1 = torch.linspace(-1, 1, gs, device=x.device) gy, gx = torch.meshgrid(g1, g1, indexing='ij') grid = torch.stack([gx, gy], dim=-1).reshape(-1, 2)[:self.points_per_token] grid = grid.unsqueeze(0).unsqueeze(0).expand(B2, N_tok, -1, -1) pc_feat_e = pc_feat.unsqueeze(2).expand(-1, -1, self.points_per_token, -1) fold_in = torch.cat([pc_feat_e, grid], dim=-1) pred_pc = self.decoder_pc_fold( fold_in.reshape(B2 * N_tok * self.points_per_token, -1) ).reshape(B2, N_tok * self.points_per_token, 3)
if pred_pc.shape[1] > self.target_points: pred_pc = pred_pc[:, :self.target_points] elif pred_pc.shape[1] < self.target_points: pad = self.target_points - pred_pc.shape[1] pred_pc = torch.cat([pred_pc, pred_pc[:, :pad]], dim=1)
if return_features: return pred_rgb, pred_depth, pred_pc, pred_params, feats return pred_rgb, pred_depth, pred_pc, pred_params
# -- Loss ------------------------------------------------------------------
def forward_loss(self, imgs_rgb, imgs_depth, pc, param_floats, text_valid, pred_rgb, pred_depth, pred_pc, pred_params, mask_rgb, mask_depth, mask_pc, mask_text): """Loss over ACTIVE modalities only.
`total` sums only the active terms -- an inactive modality contributes nothing and is not reconstructed at all. Inactive components come back as a zero scalar rather than None so the 5-tuple signature and every downstream .item() / logging call keep working unchanged.
IMPORTANT for the E2 ablation: because `total` sums a different number of terms per arm, it is NOT comparable across arms and must not be used for best-model selection in a cross-arm comparison. Use the per-modality components, or the arm-invariant Chamfer computed in evaluate(). """ act = self.active_modalities dev = pc.device if isinstance(pc, torch.Tensor) else imgs_rgb.device
def zero(): return torch.zeros((), device=dev)
if 'rgb' in act: tgt_rgb = self.patchify(imgs_rgb, self.patch_size, imgs_rgb.shape[1]) if self.norm_pix_loss: m = tgt_rgb.mean(-1, keepdim=True) v = tgt_rgb.var(-1, keepdim=True) tgt_rgb = (tgt_rgb - m) / (v + 1e-6) ** .5 l = ((pred_rgb - tgt_rgb) ** 2).mean(-1) # clamp(min=1): when RGB is the fully-visible cross-modal source, # mask_rgb is all-zero -> guard against 0/0 (yields 0 loss, no NaN). loss_rgb = (l * mask_rgb).sum() / mask_rgb.sum().clamp(min=1) else: loss_rgb = zero()
if 'depth' in act: tgt_d = self.patchify(imgs_depth, self.patch_size, imgs_depth.shape[1]) B_d, N_d = tgt_d.shape[0], tgt_d.shape[1] tf = tgt_d.reshape(B_d, -1) if self.depth_norm_type == 'minmax': t_min = tf.min(1, keepdim=True).values t_max = tf.max(1, keepdim=True).values tf = (tf - t_min) / (t_max - t_min).clamp(min=1e-6) elif self.depth_norm_type == 'standard': tf = (tf - tf.mean(1, keepdim=True)) / tf.std(1, keepdim=True).clamp(min=1e-6) tgt_d = tf.reshape(B_d, N_d, -1) l = ((pred_depth - tgt_d) ** 2).mean(-1) loss_depth = (l * mask_depth).sum() / mask_depth.sum().clamp(min=1) else: loss_depth = zero()
# PC is always active -- enforced in __init__. if self.pc_loss_name == 'qal_loss': loss_pc = qal_loss( pred_pc, pc, threshold=self.qal_threshold, alpha=self.qal_alpha, use_squared=self.qal_use_squared, ) elif self.pc_loss_name == 'chamfer_cdist': d = torch.cdist(pred_pc, pc) ** 2 loss_pc = d.min(dim=2).values.mean() + d.min(dim=1).values.mean() del d elif self.pc_loss_name == 'sinkhorn': loss_pc = pred_pc.new_zeros(()) else: loss_pc = chamfer_distance(pred_pc, pc) if self.pc_sinkhorn_weight > 0: loss_pc = loss_pc + self.pc_sinkhorn_weight * sinkhorn_pc_loss( pred_pc, pc, n_points=self.pc_sinkhorn_points, blur=self.pc_sinkhorn_blur)
if 'text' in act: # Smooth-L1 (Huber) on normalised float params. All targets and # predictions are in [0, 1] -> well-conditioned gradients. Loss is # only over tokens that are (a) masked and (b) real (text_valid=1). B, L, P = pred_params.shape # P = N_PARAMS per_pos = F.smooth_l1_loss( pred_params.reshape(B * L, P), param_floats.reshape(B * L, P), reduction='none', beta=0.1, ).mean(-1).reshape(B, L) eff_mask = mask_text * text_valid loss_text = (per_pos * eff_mask).sum() / eff_mask.sum().clamp(min=1) else: loss_text = zero()
total = loss_pc * self.pc_loss_weight if 'rgb' in act: total = total + loss_rgb if 'depth' in act: total = total + loss_depth if 'text' in act: total = total + loss_text * self.spline_loss_weight
return total, loss_rgb, loss_depth, loss_pc, loss_text def patchify(self, imgs, patch_size, in_chans): p = patch_size h = w = imgs.shape[2] // p x = imgs.reshape(imgs.shape[0], in_chans, h, p, w, p) x = torch.einsum('nchpwq->nhwpqc', x) return x.reshape(imgs.shape[0], h * w, p ** 2 * in_chans)
def decode_params_to_text(self, pred_params: torch.Tensor) -> list[list[str]]: """Decode predicted float params back to human-readable text. pred_params : (B, n_text_tokens, N_PARAMS) returns : list[list[str]] (B, n_text_tokens) [] when the text modality is inactive (no param head). """ if 'text' not in self.active_modalities or pred_params is None: return [] p = pred_params.clamp(0, 1).detach().cpu().numpy() result = [] for b in range(p.shape[0]): row = [] for ti in range(p.shape[1]): if ti == 0: row.append(_params_to_plant_text(p[b, ti])) else: row.append(_params_to_leaf_text(p[b, ti])) result.append(row) return result
# ── Full forward ──────────────────────────────────────────────────────────
def forward(self, imgs_rgb, imgs_depth, pc, param_floats, text_valid, mask_ratio: float = 0.75, visible=None, return_features: bool = False, source_mask_ratio: float = 0.0, targets=None): """ targets : None (default, every run before 2026-10-16) -> the inputs are also the reconstruction targets, as in a plain MAE. Else a 3-tuple (tgt_rgb, tgt_depth, tgt_pc) of tensors shaped like the inputs: the encoder sees the inputs, the loss is taken against these. The maize ROW trainer feeds the occluded row render and scores against the target plant alone (train_maize_row_4m.py); params are always both. imgs_rgb : (B, 3, H, W) imgs_depth : (B, 1, H, W) pc : (B, N, 3) param_floats: (B, 1+max_leaves, N_PARAMS) float32 — encoder input + target text_valid : (B, 1+max_leaves) float32 — 1=real token, 0=pad
visible : None → standard Dirichlet token masking (original behaviour). iterable subset of {'rgb','depth','pc','text'} → cross-modal mode: those modalities are fully visible, the rest fully masked and reconstructed from them. return_features : if True, append (decoder_feats, cls_latent) to the output for distillation. decoder_feats is token-aligned across masking regimes; cls_latent is the encoder CLS token (B, embed_dim). """ if visible is None: (latent, mr, md, mp, mt, rr, rd, rp, rt, lr_, ld_, lp_, lt_) = self.forward_encoder( imgs_rgb, imgs_depth, pc, param_floats, mask_ratio) else: (latent, mr, md, mp, mt, rr, rd, rp, rt, lr_, ld_, lp_, lt_) = self.forward_encoder_select( imgs_rgb, imgs_depth, pc, param_floats, visible, source_mask_ratio=source_mask_ratio)
dec = self.forward_decoder( latent, rr, rd, rp, rt, lr_, ld_, lp_, lt_, return_features=return_features) if return_features: pred_rgb, pred_depth, pred_pc, pred_params, feats = dec else: pred_rgb, pred_depth, pred_pc, pred_params = dec
if targets is None: tgt_rgb, tgt_depth, tgt_pc = imgs_rgb, imgs_depth, pc else: tgt_rgb, tgt_depth, tgt_pc = targets total, loss_rgb, loss_depth, loss_pc, loss_text = self.forward_loss( tgt_rgb, tgt_depth, tgt_pc, param_floats, text_valid, pred_rgb, pred_depth, pred_pc, pred_params, mr, md, mp, mt)
out = (total, (loss_rgb, loss_depth, loss_pc, loss_text), (pred_rgb, pred_depth, pred_pc, pred_params), (mr, md, mp, mt)) if return_features: out = out + ((feats, latent[:, 0]),) return out
# ── Convenience constructors ─────────────────────────────────────────────────
def embodied_mae_4m_small(**kwargs): return EmbodiedMAE4M(embed_dim=384, depth=12, num_heads=6, decoder_embed_dim=192, decoder_depth=4, decoder_num_heads=3, **kwargs)
def embodied_mae_4m_base(**kwargs): return EmbodiedMAE4M(embed_dim=768, depth=12, num_heads=12, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, **kwargs)
def embodied_mae_4m_large(**kwargs): return EmbodiedMAE4M(embed_dim=1024, depth=24, num_heads=16, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, **kwargs)
# ── Smoke test ────────────────────────────────────────────────────────────────
if __name__ == '__main__': device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
B = 2 rgb = torch.randn(B, 3, 224, 224, device=device) depth = torch.randn(B, 1, 224, 224, device=device) pc = torch.randn(B, 8196, 3, device=device)
# The four E2 arms, in the order they appear in the submission plan. ARMS = [ ('PC', ['pc']), ('PC+RGB', ['pc', 'rgb']), ('PC+RGB+D', ['pc', 'rgb', 'depth']), ('+params', ['pc', 'rgb', 'depth', 'text']), ]
print(f"{'arm':<10} {'params':>13} {'vis tok':>8} {'total':>9} " f"{'rgb':>7} {'depth':>7} {'pc':>10} {'text':>9}") print('-' * 80)
for label, mods in ARMS: model = embodied_mae_4m_base( target_points=8196, active_modalities=mods, text_mask_ratio=0.80 if 'text' in mods else None, ).to(device)
n_text = 1 + model.max_leaves params = torch.rand(B, n_text, N_PARAMS, device=device) text_valid = torch.ones(B, n_text, device=device) text_valid[:, 22:] = 0
total, (lr, ld, lp, lt), (pr, pd, pp, ppar), _ = model( rgb, depth, pc, params, text_valid, mask_ratio=0.80)
# Visible tokens the encoder actually saw (excluding CLS). with torch.no_grad(): emb = model._embed_active(rgb, depth, pc, params) msk = model.random_masking_dirichlet(emb, 0.80) ntok = sum(v[0].shape[1] for v in msk.values())
nparam = sum(q.numel() for q in model.parameters()) print(f"{label:<10} {nparam:>13,} {ntok:>8} {total.item():>9.4f} " f"{lr.item():>7.4f} {ld.item():>7.4f} {lp.item():>10.6f} {lt.item():>9.6f}")
# An inactive modality must produce no prediction and no loss. for name, pred, loss in (('rgb', pr, lr), ('depth', pd, ld), ('text', ppar, lt)): if name in mods: assert pred is not None, f"{label}: {name} active but pred is None" else: assert pred is None, f"{label}: {name} inactive but pred is not None" assert loss.item() == 0.0, f"{label}: {name} inactive but loss={loss.item()}" assert pp is not None, f"{label}: pc prediction missing"
# decode_params_to_text must degrade gracefully when text is off. txt = model.decode_params_to_text(ppar) assert (len(txt) == B) if 'text' in mods else (txt == [])
# The cross-modal probe path must work per arm, and must reject a # modality the arm does not have. probe_visible = [m for m in ('rgb', 'depth', 'pc') if m in mods] model(rgb, depth, pc, params, text_valid, visible=probe_visible) if 'text' not in mods: try: model(rgb, depth, pc, params, text_valid, visible=['text']) raise AssertionError(f"{label}: visible=['text'] should have raised") except ValueError: pass
# Backward must reach every parameter this arm actually has. total.backward() missing = [n for n, q in model.named_parameters() if q.requires_grad and q.grad is None] assert not missing, f"{label}: no grad for {missing[:4]}"
print('-' * 80) print("All four arms: built, forward+backward, gating asserted.")
# The all-four arm must stay checkpoint-compatible with the pre-gate model. full = embodied_mae_4m_base(target_points=8196) sd = full.state_dict() print(f"\nFull arm: {len(sd)} state_dict tensors, " f"{sum(q.numel() for q in full.parameters()):,} params " f"(default active_modalities={full.active_modalities})")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385#!/usr/bin/env python3"""EmbodiedMAE-4M for MAIZE — RGB + Depth + PointCloud + procedural params.
Maize and sorghum are kept as separate pipelines on purpose. This file ownseverything maize-specific; `embodied_mae_4m.py` is never modified and neverlearns about maize.
What is NOT duplicated: the encoder/decoder machinery is genuinely identicalacross species, and `N_PARAMS` couples to it at exactly two constructionpoints — `ParamEmbed(N_PARAMS, embed_dim)` (embodied_mae_4m.py:491) and`nn.Linear(decoder_embed_dim, N_PARAMS)` (:558). Everything else reads widthsoff the tensors. So this subclasses `EmbodiedMAE4M` and rebuilds those twomodules at maize width, rather than cloning 1,100 lines that would drift.`max_leaves` is already a constructor argument and needs no surgery.
──────────────────────────────────────────────────────────────────────────────PARAMETER LAYOUT — N_PARAMS = 14, MAX_LEAVES = 28──────────────────────────────────────────────────────────────────────────────Derived from all 2,250 plants / 27,278 leaves of the complete `test` split. Thesource XML carries 48 attributes and **31 of them are dropped**, which matters:keeping them would repeat the sorghum failure where constant fields inflated thereported parameter accuracy (see the parameter-metric note in README.md).
Dropped, and why: * 26 are CONSTANT across every plant — the whole `<Tassel>` block bar `matureDroopStrength`, `<Tiller>@type/@alpha`, `<plant>@species/@phenotypeId`, and 9 of the 26 `<leaf>` attributes (splinePoints, surfaceNoise*, midrib*, ligule*, sheathOuterScale). Maize is worse than sorghum here, not better. * 3 are DETERMINISTIC RESTATEMENTS a constancy check cannot see: `waveRAmp` is bit-identical to `waveLAmp` (max|diff| = 0.0 over 27,278 records), `waveRFreq` to `waveLFreq`, and `waveRPhase == waveLPhase + 1.57` (the generator's literal 1.57, not pi/2). * `<Tassel>@seed` == the integer plant id for 2,250/2,250 plants. It is an IDENTITY LEAK, not a phenotype, and because splits are assigned by plant id it leaks split membership too. * `<leaf>@id` is 0..n-1 in document order; the token index already carries it.
`leafAzimuthDeg` is stored as `azJitterDeg`, NOT raw and NOT sin/cos: leafAzimuthDeg == (180.0 * leaf_index + U(-15, +15)) mod 360i.e. distichous phyllotaxis — leaves alternate 180° with a small jitter. * Raw linear is wrong: 34.3 % of leaves sit within 10° of the 0/360 seam, so two physically identical leaves land a full range apart and Smooth-L1 rewards predicting 180°, the one direction no leaf points. * sin/cos is ALSO wrong here: cos(az) is ±1 by leaf parity, so a decoder that ignores every input modality scores R² = 0.9999 on that slot. That is the sorghum roll_angle bug's twin — a free win that inflates the metric. * `azJitterDeg = wrap180(az - 180*leaf_index)` is exactly invertible, has no seam, and scores R² = 0.0007 from token position alone.
`waveLPhase` IS genuinely circular (radians, span 10.62 > 2π) with noindex-relative trick available, so it takes a sin/cos pair and decodes by atan2.`leafTwist`, `leafAngle`, `droopiness`, `stemInclinationDeg` are in degrees butdo NOT wrap — they are bounded physical quantities. Do not "fix" them.
Round-trip raw → norm → raw was validated at max abs error 8.5e-14 (leaf) and2.2e-16 (plant), with ZERO values clipped at either end of [0, 1]."""
from __future__ import annotations
import mathimport xml.etree.ElementTree as ET
import numpy as npimport torchimport torch.nn as nn
from embodied_mae_4m import EmbodiedMAE4M, ParamEmbed
# ── Numeric parameter layout ─────────────────────────────────────────────────
N_PARAMS = 14 # float vector per token (sorghum uses 9)MAX_LEAVES = 28 # observed 4..22 leaves/plant; headroom (sorghum uses 24)
PLANT_FIELDS = ('leafCount', 'stemRadius', 'stemShrink', 'tasselMatureDroopStrength', 'stemInternodeSum')LEAF_FIELDS = ('distance', 'leafLength', 'leafWidth', 'leafAngle', 'droopiness', 'stemInclinationDeg', 'widthTaper', 'leafTwist', 'leafCurl', 'waveLAmp', 'waveLFreq', 'azJitterDeg', 'sinWavePhase', 'cosWavePhase')
# norm = clip((raw + SHIFT) / SCALE, 0, 1) · raw = norm * SCALE - SHIFT# Same convention as sorghum so the loss and decoder need no changes.# Defined ONCE. (embodied_mae_4m.py defines its equivalents twice, lines 46-97# and 245-306, with the second shadowing the first — editing only the first is a# silent no-op. Do not reintroduce that here.)_PLANT_SCALE = np.array([32.0, 0.03, 0.02, 3.5, 2.0] + [1.0] * 9, np.float32)_PLANT_SHIFT = np.array([0.0, 0.0, 0.0, 0.0, 0.0] + [0.0] * 9, np.float32)
_LEAF_SCALE = np.array([0.40, 0.85, 0.15, 180.0, 120.0, 4.0, 2.0, 600.0, 1.7, 0.04, 60.0, 40.0, 2.0, 2.0], np.float32)_LEAF_SHIFT = np.array([0.00, -0.05, 0.00, 90.0, 150.0, 2.0, -2.0, 300.0, 0.5, 0.00, 12.0, 20.0, 1.0, 1.0], np.float32)
def _wrap180(deg): """Map an angle difference into (-180, 180].""" return (deg + 180.0) % 360.0 - 180.0
def _plant_to_params(tassel, tiller, leaves) -> np.ndarray: """Plant token: 5 informative slots, zero-padded to N_PARAMS.""" raw = np.zeros(N_PARAMS, dtype=np.float32) raw[0] = float(len(leaves)) raw[1] = float(tiller.get('radius', 0.0)) raw[2] = float(tiller.get('stemShrink', 0.0)) raw[3] = float(tassel.get('matureDroopStrength', 0.0)) if tassel is not None else 0.0 # stem_internodeSum is the one plant-level field that is not a raw XML # attribute: it aggregates the per-leaf `distance`, and plant_scores.csv's # `stem_internodeSum` column is exactly this sum (pearson r = 1.000000). raw[4] = float(sum(float(lf.get('distance', 0.0)) for lf in leaves)) return np.clip((raw + _PLANT_SHIFT) / _PLANT_SCALE, 0.0, 1.0)
def _leaf_to_params(leaf, leaf_index: int) -> np.ndarray: """Leaf token. `leaf_index` is needed to de-trend the azimuth.""" phase = float(leaf.get('waveLPhase', 0.0)) az = float(leaf.get('leafAzimuthDeg', 0.0)) raw = np.array([ float(leaf.get('distance', 0.0)), float(leaf.get('leafLength', 0.0)), float(leaf.get('leafWidth', 0.0)), float(leaf.get('leafAngle', 0.0)), float(leaf.get('droopiness', 0.0)), float(leaf.get('stemInclinationDeg', 0.0)), float(leaf.get('widthTaper', 0.0)), float(leaf.get('leafTwist', 0.0)), float(leaf.get('leafCurl', 0.0)), float(leaf.get('waveLAmp', 0.0)), float(leaf.get('waveLFreq', 0.0)), _wrap180(az - 180.0 * leaf_index), # azJitterDeg math.sin(phase), math.cos(phase), ], dtype=np.float32) return np.clip((raw + _LEAF_SHIFT) / _LEAF_SCALE, 0.0, 1.0)
# ── Data version 2 (2026-10-06): the trimmed XML ─────────────────────────────# The maize data was re-exported with a trimmed spline XML (`params/index.json`:# "trimmed record, same fields as <view>/maize_<no>_spline.xml"). It carries# <plant height> · <leaf id distance leafLength leafWidth leafAzimuthDeg# leafAngle droopiness avgCurvature bendAngleDeg bladeLength> · <LeafCurvature># and NONE of the v1 fields (Tassel, Tiller radius/stemShrink, stemInclinationDeg,# widthTaper, leafTwist, leafCurl, wave*). The v1 builders read every field with# `.get(k, 0.0)`, so on a v2 file they do not fail: they emit seven constant leaf# slots and three constant plant slots. Hence a separate, STRICT layout here.## Dropped from v2, measured over all 15,000 plants / 186,134 leaves# (plant_params.jsonl) and val+test XML:# * bladeLength == 0.8052-0.8055 x leafLength — a deterministic restatement.# * bendAngleDeg == -droopiness - 4.5..10.2, r = -1.0000 (linear R² from the# other fields 0.9999999) — a restatement.# * <LeafCurvature> meanLeafCurvature / meanBendAngleDeg are the per-leaf means# (max|diff| 4e-06), and avgCurvature is r = 0.996 with them.# * <leaves number> == the leaf count; <leaf id> is the token index.# Kept: height (genuinely new; r = 0.984 with internode sum, 0.226 with leaf# count) and per-leaf avgCurvature (1/m; r = -0.906 with leafLength).# Observed ranges over all 15,000 plants, which the scales below cover with# zero clipping: height 0.618-1.443, leaves 3-22, internode sum 0.434-1.239,# distance 0.0127-0.335, leafLength 0.100-0.751, leafWidth 0.010-0.117,# leafAngle -49.9..103.8 (v1's [-90, 90] would clip it), droopiness# -121.3..-54.3, avgCurvature 2.45-16.8, azJitterDeg -15..15.# N_PARAMS stays 14 so model shapes (and every v1 checkpoint) are unchanged; the# unused slots are zero, as v1's plant token already was for 9 of its 14.PARAM_SCHEMAS = ('v1', 'v2')
PLANT_FIELDS_V2 = ('leafCount', 'stemInternodeSum', 'height')LEAF_FIELDS_V2 = ('distance', 'leafLength', 'leafWidth', 'leafAngle', 'droopiness', 'avgCurvature', 'azJitterDeg')
_PLANT_SCALE_V2 = np.array([32.0, 2.0, 2.0] + [1.0] * 11, np.float32)_PLANT_SHIFT_V2 = np.zeros(N_PARAMS, np.float32)_LEAF_SCALE_V2 = np.array([0.40, 0.85, 0.15, 180.0, 120.0, 25.0, 40.0] + [1.0] * 7, np.float32)_LEAF_SHIFT_V2 = np.array([0.00, -0.05, 0.00, 60.0, 150.0, 0.0, 20.0] + [0.0] * 7, np.float32)
def xml_param_schema(root) -> str: """'v1' for the full generator XML, 'v2' for the 2026-10-06 trimmed one.""" tiller = root.find('Tiller') leaf = tiller.find('./leaves/leaf') if tiller is not None else None if root.find('Tassel') is not None or (leaf is not None and 'leafTwist' in leaf.attrib): return 'v1' if 'height' in root.attrib: return 'v2' raise ValueError('maize spline XML matches neither known schema ' '(no <Tassel>/leafTwist for v1, no <plant height> for v2)')
def _plant_to_params_v2(root, leaves) -> np.ndarray: raw = np.zeros(N_PARAMS, dtype=np.float32) raw[0] = float(len(leaves)) raw[1] = float(sum(float(lf.attrib['distance']) for lf in leaves)) raw[2] = float(root.attrib['height']) return np.clip((raw + _PLANT_SHIFT_V2) / _PLANT_SCALE_V2, 0.0, 1.0)
def _leaf_to_params_v2(leaf, leaf_index: int) -> np.ndarray: a = leaf.attrib # KeyError, never a silent 0.0 raw = np.zeros(N_PARAMS, dtype=np.float32) raw[:7] = [float(a['distance']), float(a['leafLength']), float(a['leafWidth']), float(a['leafAngle']), float(a['droopiness']), float(a['avgCurvature']), _wrap180(float(a['leafAzimuthDeg']) - 180.0 * leaf_index)] return np.clip((raw + _LEAF_SHIFT_V2) / _LEAF_SCALE_V2, 0.0, 1.0)
def _params_to_plant_text_v2(params: np.ndarray) -> str: raw = np.clip(np.asarray(params, dtype=np.float32), 0.0, 1.0) * _PLANT_SCALE_V2 - _PLANT_SHIFT_V2 n, isum, h = raw[:3] return f"n={n:.1f} internode={isum:.4f} height={h:.4f}"
def _params_to_leaf_text_v2(params: np.ndarray) -> str: raw = np.clip(np.asarray(params, dtype=np.float32), 0.0, 1.0) * _LEAF_SCALE_V2 - _LEAF_SHIFT_V2 d, ln, w, ang, drp, cur, azj = raw[:7] return (f"d={d:.4f} len={ln:.4f} w={w:.4f} ang={ang:+06.2f} " f"droop={drp:+07.2f} curv={cur:.3f} azJit={azj:+06.2f}")
def _params_to_plant_text(params: np.ndarray) -> str: p = np.clip(np.asarray(params, dtype=np.float32), 0.0, 1.0) raw = p * _PLANT_SCALE - _PLANT_SHIFT n, r, sh, td, isum = raw[:5] return (f"n={n:.1f} r={r:.5f} shrink={sh:.5f} " f"droop={td:.3f} internode={isum:.4f}")
def _params_to_leaf_text(params: np.ndarray) -> str: p = np.clip(np.asarray(params, dtype=np.float32), 0.0, 1.0) raw = p * _LEAF_SCALE - _LEAF_SHIFT (d, ln, w, ang, drp, inc, tap, tw, cur, wa, wf, azj, s, c) = raw phase = math.atan2(s, c) # circular decode return (f"d={d:.4f} len={ln:.4f} w={w:.4f} ang={ang:+06.2f} " f"droop={drp:+07.2f} twist={tw:+07.2f} curl={cur:+.3f} " f"wAmp={wa:.5f} wFreq={wf:+06.2f} azJit={azj:+06.2f} ph={phase:+.3f}")
def load_spline_params(xml_path, max_leaves: int = MAX_LEAVES, schema=None): """Parse a maize spline XML into the 4M text-modality tensors.
`schema` ('v1' | 'v2' | None) is the layout the caller expects; the file's own schema is detected and a mismatch raises. None accepts either (eval code written before data version 2 passes nothing).
Returns valid : (1+max_leaves,) float32 — 1=real token, 0=pad param_floats : (1+max_leaves, N_PARAMS) float32 — encoder input + target
Same signature and return order as the sorghum loader so the dataset and training loop are unchanged. ElementTree parses these in ~0.26 ms against ~85 ms for a sorghum YAML — about 300x cheaper, which materially changes the dataloader budget (sorghum's YAML parse was 72 % of per-item cost). """ root = ET.parse(xml_path).getroot() tassel = root.find('Tassel') tiller = root.find('Tiller') if tiller is None: raise ValueError(f'{xml_path}: no <Tiller>') leaves = tiller.findall('./leaves/leaf') found = xml_param_schema(root) if schema is not None and found != schema: raise ValueError(f'{xml_path}: spline XML is schema {found}, ' f'this run expects {schema}') if found == 'v2' and not leaves: raise ValueError(f'{xml_path}: no <leaf> elements')
n_tokens = 1 + max_leaves valid = np.zeros(n_tokens, dtype=np.float32) param_floats = np.zeros((n_tokens, N_PARAMS), dtype=np.float32)
valid[0] = 1.0 param_floats[0] = (_plant_to_params_v2(root, leaves) if found == 'v2' else _plant_to_params(tassel, tiller, leaves))
leaf_fn = _leaf_to_params_v2 if found == 'v2' else _leaf_to_params for i, leaf in enumerate(leaves[:max_leaves]): valid[1 + i] = 1.0 param_floats[1 + i] = leaf_fn(leaf, i)
return torch.from_numpy(valid), torch.from_numpy(param_floats)
# ── Model ────────────────────────────────────────────────────────────────────
class EmbodiedMAE4MMaize(EmbodiedMAE4M): """EmbodiedMAE4M at maize parameter width.
Rebuilds only the two modules whose shape depends on N_PARAMS. The encoder, decoder, masking, losses and the whole forward path are inherited unchanged — they read widths off the tensors. """
def __init__(self, *args, max_leaves: int = MAX_LEAVES, param_schema: str = 'v1', **kwargs): if param_schema not in PARAM_SCHEMAS: raise ValueError(f'param_schema must be one of {PARAM_SCHEMAS}, got {param_schema!r}') super().__init__(*args, max_leaves=max_leaves, **kwargs) # Only decode_params_to_text reads this; shapes are identical in v1 and v2. self.param_schema = param_schema
if 'text' in self.active_modalities: # Encoder side: embodied_mae_4m.py:491 built this at sorghum width. embed_dim = self.param_embed.proj.out_features self.param_embed = ParamEmbed(N_PARAMS, embed_dim)
# Decoder side: the last Linear of decoder_pred_params # (embodied_mae_4m.py:553-559) emits one float per parameter slot. head = self.decoder_pred_params last = head[-1] if not isinstance(last, nn.Linear): raise RuntimeError( f'decoder_pred_params tail is {type(last).__name__}, not ' 'nn.Linear — the head layout changed upstream and this ' 'subclass needs updating rather than silently mis-sizing.') head[-1] = nn.Linear(last.in_features, N_PARAMS)
self.n_params = N_PARAMS
def decode_params_to_text(self, pred_params) -> list[list[str]]: """Decode predicted float params back to human-readable text.
pred_params : (B, n_text_tokens, N_PARAMS) returns : list[list[str]] (B, n_text_tokens) [] when the text modality is inactive (no param head).
This mirrors EmbodiedMAE4M.decode_params_to_text's contract exactly and is overridden ONLY to reach maize's 14-field formatters (with the circular phase decode) instead of sorghum's nine-field ones.
The batch dimension is not optional. `train_maize_4m.py:290` hands this the whole visualisation batch and unpacks `list[list[str]]`; an earlier version of this method took a single (n_tokens, N_PARAMS) sample, which type-checks all the way down to the f-string and only then dies with "unsupported format string passed to numpy.ndarray.__format__" — during the epoch-1 visualisation, i.e. after a successful epoch of training. Hence the explicit rank check rather than quietly accepting either shape. """ if 'text' not in self.active_modalities or pred_params is None: return [] if torch.is_tensor(pred_params): p = pred_params.clamp(0, 1).detach().cpu().numpy() else: p = np.clip(np.asarray(pred_params, dtype=np.float32), 0.0, 1.0) if p.ndim != 3: raise ValueError( f'decode_params_to_text expects (B, n_text_tokens, N_PARAMS); ' f'got shape {p.shape}. Pass the batch, not a single sample.') plant_fn, leaf_fn = ((_params_to_plant_text_v2, _params_to_leaf_text_v2) if self.param_schema == 'v2' else (_params_to_plant_text, _params_to_leaf_text)) return [[plant_fn(p[b, t]) if t == 0 else leaf_fn(p[b, t]) for t in range(p.shape[1])] for b in range(p.shape[0])]
def embodied_mae_4m_maize_small(**kw): return EmbodiedMAE4MMaize(embed_dim=384, depth=12, num_heads=6, decoder_embed_dim=192, decoder_depth=4, decoder_num_heads=3, **kw)
def embodied_mae_4m_maize_base(**kw): return EmbodiedMAE4MMaize(embed_dim=768, depth=12, num_heads=12, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, **kw)
def embodied_mae_4m_maize_large(**kw): return EmbodiedMAE4MMaize(embed_dim=1024, depth=24, num_heads=16, decoder_embed_dim=512, decoder_depth=8, decoder_num_heads=16, **kw)
if __name__ == '__main__': m = embodied_mae_4m_maize_base() n_text = 1 + m.max_leaves print(f'EmbodiedMAE-4M-Maize-Base params={sum(p.numel() for p in m.parameters()):,}') print(f' N_PARAMS={N_PARAMS} max_leaves={m.max_leaves} text tokens={n_text}') B = 2 out = m(torch.randn(B, 3, 224, 224), torch.randn(B, 1, 224, 224), torch.randn(B, 8192, 3), torch.rand(B, n_text, N_PARAMS), torch.ones(B, n_text), mask_ratio=0.8) print(' forward OK:', type(out).__name__)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455"""Sinkhorn (entropic optimal-transport) term for the point-cloud loss.
Why. Chamfer and QAL match every point to its NEAREST neighbour, so manypredicted points can share one target point at no cost: the folding headcollapses most tokens' 41 points into a tight clump and recall rises onlyslowly with training (the development notes, "the PC decoder collapses"). Optimal transportmatches the two clouds as distributions, one unit of mass each way, so a clumpthat covers one spot leaves the rest of the target unmatched and pays for it --it rewards coverage (recall) directly.
What. The debiased Sinkhorn divergence of geomloss (p = 2, so for small `blur`it approaches half the squared 2-Wasserstein distance) between RANDOM subsetsof `n_points` predicted and `n_points` target points, the same subsets acrossthe batch, redrawn every call. Subsampling keeps the dense cost matrix atB x n x n (2048^2 x 16 floats = 268 MB) on geomloss's pure-PyTorch'tensorized' backend, which needs no KeOps / nvcc on the GPU node; over manysteps every predicted point is drawn. Sized 2026-10-04 (job 16716188) on theuniform scene arms' own predictions: the divergence is ~0.05-0.1, about 100xthe subsampling floor (two random 2048-subsets of the SAME cloud: 0.0006), andit GROWS from epoch 20 to 200 (sorghum 0.053 -> 0.071) while QAL falls(0.058 -> 0.033) -- QAL training trades distribution match for nearest-point fit.blur 0.01 and 0.02 gave the same values; 2048 points at scaling 0.9 nearlydoubled the step time, so the arms use 1024 points, blur 0.02, scaling 0.8. `blur` is in the unit-sphere frame, thesame units as the F-score thresholds (0.01 ~ 7 mm on a 1.4 m plant).
The model adds `pc_sinkhorn_weight` x this to the QAL / chamfer term(embodied_mae_4m.EmbodiedMAE4M, YAML `model.pc_sinkhorn_*`); weight 0, thedefault, never imports geomloss and leaves every earlier run unchanged."""
import torch
_LOSSES = {}
def sinkhorn_pc_loss(pred, target, n_points=2048, blur=0.01, scaling=0.8): """Mean over the batch of the debiased Sinkhorn divergence between random `n_points` subsets of pred (B, N, 3) and target (B, M, 3).""" from geomloss import SamplesLoss key = (float(blur), float(scaling)) if key not in _LOSSES: _LOSSES[key] = SamplesLoss('sinkhorn', p=2, blur=key[0], scaling=key[1], backend='tensorized') N, M = pred.shape[1], target.shape[1] ip = torch.randperm(N, device=pred.device)[:min(int(n_points), N)] it = torch.randperm(M, device=target.device)[:min(int(n_points), M)] # geomloss switches autograd ON inside its call and does not restore it, so # under torch.no_grad() (validation) every later op would build a graph -- # checked 2026-10-05: is_grad_enabled() False -> True. Restore the caller's mode. grad_mode = torch.is_grad_enabled() try: return _LOSSES[key](pred[:, ip].contiguous(), target[:, it].contiguous()).mean() finally: torch.set_grad_enabled(grad_mode)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130"""CropCode inference: run a released model on a sample (or on inputs you prepared the same way).
python inference.py --list python inference.py --model sorghum-generalist --sample samples/sorghum/plant_Sorghum_10756 --source rgb python inference.py --model maize-field --sample samples/maize/field_0204_row0936_stop06
A sample folder holds `inputs.npz`, the tensors the model reads, written by the training loaders: rgb (3, 224, 224) float32, ImageNet-normalised photograph (plant pixels on black) depth (1, 224, 224) float32, encoded depth, 0 = background pc (N, 3) float32, point cloud centred and scaled to the unit sphere scale () metres per unit of the cloud frameand, when known, the truth: `gt_pc` (M, 3) in the same frame, `height_m`, `leaves`.Writes <out>/pred_cloud.ply (metres, centred like the input cloud), <out>/recipe.json (the written proceduralparameters: plant height, leaf count and one record per leaf) and <out>/summary.json."""import argparse, json, pathlib, sysimport numpy as npimport torch
HERE = pathlib.Path(__file__).resolve().parentsys.path.insert(0, str(HERE / 'cropcode_model'))MODALITIES = ('rgb', 'depth', 'pc', 'text')
def build(name, device): d = HERE / 'models' / name cfg = json.loads((d / 'config.json').read_text()); sp = cfg['species'] if sp == 'maize': import embodied_mae_4m_maize as M factory = getattr(M, f"embodied_mae_4m_maize_{cfg.get('model_size', 'base')}"); kw = dict(param_schema=cfg.get('param_schema') or 'v1') n_pts, n_leaves = 8192, 28 else: import embodied_mae_4m as M factory = getattr(M, f"embodied_mae_4m_{cfg.get('model_size', 'base')}"); kw = {} n_pts, n_leaves = 8196, 24 model = factory(active_modalities=cfg.get('active_modalities'), img_size=cfg.get('img_size', 224), num_pc_tokens=196, target_points=cfg.get('gt_points', cfg.get('num_points', n_pts)), max_leaves=cfg.get('max_leaves', n_leaves), depth_norm_type=cfg.get('depth_norm_type', 'minmax'), pc_loss_name=cfg.get('pc_loss_name', 'qal_loss'), pc_sinkhorn_weight=0.0, text_mask_ratio=cfg.get('text_mask_ratio'), **kw) from safetensors.torch import load_file model.load_state_dict(load_file(str(d / 'model.safetensors')), strict=True) return model.to(device).eval(), cfg
@torch.no_grad()def predict(model, source, rgb, depth, pc, mask_ratio, seed=0): """source 'all': every stream visible at the training mask ratio (the masked regime the model was trained in); 'rgb' / 'depth' / 'pc': that stream alone, fully visible, the others hidden. The procedural parameters are never an input: a zero tensor stands in for them.""" torch.manual_seed(seed) act = set(model.active_modalities) zeros = torch.zeros(1, model.pos_embed_text.shape[1], model.param_embed.proj.in_features, device=rgb.device) if source == 'all': out = model.forward_encoder_select(rgb, depth, pc, zeros, visible={'rgb', 'depth', 'pc'} & act, source_mask_ratio=mask_ratio) else: out = model.forward_encoder_select(rgb, depth, pc, zeros, visible={source}, source_mask_ratio=0.0) latent, rests, nvis = out[0], out[5:9], dict(zip(MODALITIES, out[9:13])) _, _, pred_pc, pred_par = model.forward_decoder(latent, *rests, *nvis.values()) return pred_pc[0].float().cpu().numpy(), pred_par[0].float().cpu().numpy()
def decode_recipe(sp, par, cfg): """normalised (1 + K, n_params) -> height (m), leaf count and per-leaf fields in the generator's units""" par = np.clip(np.asarray(par, np.float64), 0, 1); rf = cfg.get('real_finetune') or {} if sp == 'sorghum': import embodied_mae_4m as S nf = len(S.LEAF_FIELDS); H = float(par[0, 0] * S._PLANT_SCALE[0] - S._PLANT_SHIFT[0]) raw = par[1:, :nf] * S._LEAF_SCALE[:nf] - S._LEAF_SHIFT[:nf] if rf.get('count_slots'): # leaf-count model: the leaves are the slots longer than the threshold keep = raw[:, list(S.LEAF_FIELDS).index('length')] > float(rf.get('count_threshold_m') or 0.05); raw = raw[keep] else: # synthetic sorghum: the leaf count follows the stem length raw = raw[:int(np.clip(np.rint((H + 0.001) / 0.05), 0, len(raw)))] return dict(height_m=H, leaves=len(raw), leaf_fields=list(S.LEAF_FIELDS), leaf=[[float(x) for x in r] for r in raw]) import embodied_mae_4m_maize as M sc = np.array(rf.get('leaf_scale', M._LEAF_SCALE_V2), np.float64); sh = np.array(rf.get('leaf_shift', M._LEAF_SHIFT_V2), np.float64) p = par[0] * M._PLANT_SCALE_V2 - M._PLANT_SHIFT_V2; nf = len(M.LEAF_FIELDS_V2) n = int(np.clip(np.rint(p[M.PLANT_FIELDS_V2.index('leafCount')]), 0, par.shape[0] - 1)) raw = par[1:1 + n, :nf] * sc[:nf] - sh[:nf] return dict(height_m=float(p[M.PLANT_FIELDS_V2.index('height')]), leaves=n, stem_internode_sum_m=float(p[M.PLANT_FIELDS_V2.index('stemInternodeSum')]), leaf_fields=list(M.LEAF_FIELDS_V2), leaf=[[float(x) for x in r] for r in raw])
def chamfer(a, b): """symmetric squared Chamfer (mean of both directions), same units as the clouds squared""" a, b = torch.as_tensor(a, dtype=torch.float32), torch.as_tensor(b, dtype=torch.float32) d = torch.cdist(a, b) ** 2 return float(d.min(1).values.mean() + d.min(0).values.mean())
def write_ply(path, xyz): xyz = np.asarray(xyz, np.float32) with open(path, 'wb') as f: f.write(f'ply\nformat binary_little_endian 1.0\nelement vertex {len(xyz)}\n' 'property float x\nproperty float y\nproperty float z\nend_header\n'.encode()) f.write(xyz.tobytes())
def run(model_name, sample, source='all', out=None, device='cpu', seed=0, model=None, cfg=None): if model is None: model, cfg = build(model_name, device) z = np.load(pathlib.Path(sample) / 'inputs.npz') t = lambda k: torch.from_numpy(z[k]).float()[None].to(device) P, par = predict(model, source, t('rgb'), t('depth'), t('pc'), float(cfg.get('mask_ratio', 0.8)), seed) rec = decode_recipe(cfg['species'], par, cfg); scale = float(z['scale']) res = dict(model=model_name, sample=pathlib.Path(sample).name, source=source, seed=seed, pred_height_m=round(rec['height_m'], 3), pred_leaves=rec['leaves']) if 'gt_pc' in z.files: res['chamfer_1e-4_m2'] = round(chamfer(P, z['gt_pc']) * scale ** 2 * 1e4, 2) for k in ('height_m', 'leaves'): if k in z.files: res['true_' + k] = round(float(z[k]), 3) if k == 'height_m' else int(z[k]) if out: out = pathlib.Path(out); out.mkdir(parents=True, exist_ok=True) write_ply(out / 'pred_cloud.ply', P * scale) (out / 'recipe.json').write_text(json.dumps(rec, indent=1)); (out / 'summary.json').write_text(json.dumps(res, indent=1)) return res
if __name__ == '__main__': ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument('--model'); ap.add_argument('--sample') ap.add_argument('--source', default='all', choices=('all', 'rgb', 'depth', 'pc')) ap.add_argument('--out', default=None, help='default: predictions/<sample>__<model>__<source>') ap.add_argument('--seed', type=int, default=0); ap.add_argument('--device', default='cuda' if torch.cuda.is_available() else 'cpu') ap.add_argument('--list', action='store_true', help='list the models and samples') a = ap.parse_args() if a.list or not (a.model and a.sample): print('models: ', ' '.join(sorted(p.name for p in (HERE / 'models').iterdir()))) print('samples:', ' '.join(sorted(str(p.relative_to(HERE)) for p in (HERE / 'samples').glob('*/*') if p.is_dir()))) sys.exit(0) out = a.out or HERE / 'predictions' / f'{pathlib.Path(a.sample).name}__{a.model}__{a.source}' print(json.dumps(run(a.model, a.sample, a.source, out, a.device, a.seed), indent=1)); print('wrote', out)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616{ "species": "maize", "row_root": "data/maize_row", "row_mode": "row", "train_split": "train", "val_split": "train", "val_holdout": 500, "holdout_seed": 0, "thetas": null, "img_size": 224, "num_points": 24576, "gt_points": 8192, "view_seed": 42, "sample_per_plant": true, "param_schema": "v2", "rgb_file": "rgba.png", "rgb_gain": null, "rgb_brighten_gain": 1.0, "model_size": "base", "mask_ratio": 0.8, "active_modalities": null, "text_mask_ratio": null, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_loss_weight": 1.0, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 28, "batch_size": 16, "accum_steps": 2, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "output_dir": "./outputs/maize_row_ft_e1", "save_freq": 5, "keep_last": 3, "keep_every": 25, "resume": "./outputs/maize_row_ft_e1/checkpoints/checkpoint_epoch_90.pth", "init_from": "./outputs/maize_4m_pretrain_15k_d2/checkpoints/checkpoint_epoch_1000.pth", "init_schema": "v2", "num_workers": 12, "device": "cuda", "use_wandb": true, "trainer": "row", "world_size": 1, "val_plants": [ "plant_0029", "plant_0079", "plant_0152", "plant_0174", "plant_0236", "plant_0239", "plant_0251", "plant_0279", "plant_0297", "plant_0322", "plant_0349", "plant_0362", "plant_0377", "plant_0431", "plant_0457", "plant_0462", "plant_0467", "plant_0471", "plant_0472", "plant_0475", "plant_0553", "plant_0567", "plant_0574", "plant_0612", "plant_0619", "plant_0630", "plant_0697", "plant_0706", "plant_0793", "plant_0805", "plant_0812", "plant_0855", "plant_0901", "plant_0902", "plant_0937", "plant_0968", "plant_0981", "plant_0987", "plant_10007", "plant_10050", "plant_10099", "plant_1011", "plant_10154", "plant_10160", "plant_10162", "plant_10207", "plant_10235", "plant_10236", "plant_10301", "plant_10337", "plant_10344", "plant_10348", "plant_10356", "plant_10370", "plant_10391", "plant_10422", "plant_1045", "plant_10470", "plant_10529", "plant_10533", "plant_10618", "plant_10660", "plant_1072", "plant_10727", "plant_10774", "plant_1087", "plant_10930", "plant_10935", "plant_10940", "plant_1095", "plant_10976", "plant_11005", "plant_11039", "plant_11058", "plant_11090", "plant_11126", "plant_11134", "plant_1114", "plant_11161", "plant_11174", "plant_11198", "plant_11207", "plant_11225", "plant_11246", "plant_11258", "plant_11269", "plant_11272", "plant_11329", "plant_11332", "plant_11342", "plant_11360", "plant_11399", "plant_11446", "plant_11454", "plant_11473", "plant_11475", "plant_11493", "plant_11510", "plant_11539", "plant_11589", "plant_11596", "plant_11607", "plant_1163", "plant_11652", "plant_11692", "plant_11795", "plant_11806", "plant_11829", "plant_11877", "plant_11937", "plant_12018", "plant_12064", "plant_12081", "plant_12138", "plant_12167", "plant_12184", "plant_12190", "plant_12196", "plant_12201", "plant_12239", "plant_12277", "plant_12333", "plant_12364", "plant_12394", "plant_12406", "plant_1241", "plant_12455", "plant_12480", "plant_12538", "plant_12557", "plant_12572", "plant_1259", "plant_12607", "plant_12611", "plant_12642", "plant_12662", "plant_12687", "plant_12710", "plant_12822", "plant_1287", "plant_12876", "plant_1292", "plant_12940", "plant_12954", "plant_12974", "plant_12992", "plant_12996", "plant_13046", "plant_1305", "plant_13067", "plant_13079", "plant_13085", "plant_13115", "plant_13181", "plant_1323", "plant_13253", "plant_13302", "plant_13309", "plant_13314", "plant_13369", "plant_1340", "plant_13402", "plant_13405", "plant_1348", "plant_13543", "plant_13557", "plant_13587", "plant_13619", "plant_1364", "plant_13641", "plant_13672", "plant_13736", "plant_1374", "plant_13761", "plant_13791", "plant_13857", "plant_13881", "plant_13892", "plant_13931", "plant_13935", "plant_13957", "plant_1396", "plant_13991", "plant_13994", "plant_14012", "plant_14059", "plant_1409", "plant_14101", "plant_14120", "plant_14128", "plant_14147", "plant_14157", "plant_14196", "plant_14199", "plant_1420", "plant_14250", "plant_14257", "plant_14272", "plant_14317", "plant_14326", "plant_14360", "plant_14447", "plant_14507", "plant_14520", "plant_14531", "plant_14555", "plant_14575", "plant_14619", "plant_14726", "plant_14756", "plant_14761", "plant_14767", "plant_14796", "plant_14817", "plant_14888", "plant_14898", "plant_14921", "plant_1501", "plant_1519", "plant_1522", "plant_1529", "plant_1531", "plant_1544", "plant_1548", "plant_1651", "plant_1658", "plant_1705", "plant_1713", "plant_1715", "plant_1781", "plant_1796", "plant_1817", "plant_1835", "plant_1836", "plant_1853", "plant_1870", "plant_1905", "plant_1932", "plant_1974", "plant_2006", "plant_2014", "plant_2102", "plant_2107", "plant_2134", "plant_2155", "plant_2186", "plant_2187", "plant_2247", "plant_2251", "plant_2258", "plant_2275", "plant_2298", "plant_2304", "plant_2315", "plant_2325", "plant_2374", "plant_2386", "plant_2393", "plant_2446", "plant_2568", "plant_2626", "plant_2636", "plant_2654", "plant_2655", "plant_2680", "plant_2685", "plant_2757", "plant_2799", "plant_2837", "plant_2848", "plant_2898", "plant_2901", "plant_2913", "plant_2923", "plant_2985", "plant_2987", "plant_2993", "plant_3037", "plant_3103", "plant_3193", "plant_3243", "plant_3262", "plant_3331", "plant_3368", "plant_3397", "plant_3451", "plant_3467", "plant_3475", "plant_3476", "plant_3525", "plant_3552", "plant_3611", "plant_3661", "plant_3679", "plant_3716", "plant_3731", "plant_3809", "plant_3843", "plant_3884", "plant_3916", "plant_4022", "plant_4077", "plant_4119", "plant_4129", "plant_4180", "plant_4237", "plant_4269", "plant_4321", "plant_4333", "plant_4359", "plant_4432", "plant_4449", "plant_4457", "plant_4468", "plant_4476", "plant_4481", "plant_4519", "plant_4526", "plant_4569", "plant_4599", "plant_4630", "plant_4660", "plant_4668", "plant_4687", "plant_4734", "plant_4760", "plant_4779", "plant_4795", "plant_4800", "plant_4814", "plant_4847", "plant_4851", "plant_4860", "plant_4879", "plant_4885", "plant_4945", "plant_5008", "plant_5014", "plant_5018", "plant_5062", "plant_5093", "plant_5167", "plant_5199", "plant_5218", "plant_5268", "plant_5309", "plant_5323", "plant_5387", "plant_5392", "plant_5469", "plant_5488", "plant_5578", "plant_5582", "plant_5606", "plant_5622", "plant_5654", "plant_5684", "plant_5699", "plant_5779", "plant_5800", "plant_5823", "plant_5824", "plant_5842", "plant_5894", "plant_5916", "plant_5946", "plant_5991", "plant_5999", "plant_6000", "plant_6044", "plant_6049", "plant_6119", "plant_6166", "plant_6198", "plant_6214", "plant_6224", "plant_6263", "plant_6285", "plant_6302", "plant_6368", "plant_6392", "plant_6410", "plant_6425", "plant_6457", "plant_6486", "plant_6493", "plant_6503", "plant_6538", "plant_6574", "plant_6577", "plant_6636", "plant_6661", "plant_6692", "plant_6711", "plant_6785", "plant_6837", "plant_6883", "plant_6892", "plant_7146", "plant_7217", "plant_7263", "plant_7280", "plant_7288", "plant_7325", "plant_7354", "plant_7369", "plant_7404", "plant_7441", "plant_7448", "plant_7481", "plant_7485", "plant_7495", "plant_7506", "plant_7524", "plant_7560", "plant_7581", "plant_7594", "plant_7615", "plant_7630", "plant_7636", "plant_7643", "plant_7656", "plant_7698", "plant_7735", "plant_7739", "plant_7843", "plant_7863", "plant_7930", "plant_7978", "plant_7994", "plant_8018", "plant_8034", "plant_8075", "plant_8096", "plant_8131", "plant_8138", "plant_8139", "plant_8148", "plant_8152", "plant_8269", "plant_8284", "plant_8296", "plant_8313", "plant_8322", "plant_8334", "plant_8341", "plant_8355", "plant_8402", "plant_8407", "plant_8422", "plant_8444", "plant_8479", "plant_8480", "plant_8493", "plant_8504", "plant_8514", "plant_8526", "plant_8544", "plant_8551", "plant_8615", "plant_8646", "plant_8689", "plant_8698", "plant_8799", "plant_8841", "plant_8847", "plant_8875", "plant_8881", "plant_8893", "plant_8974", "plant_9027", "plant_9032", "plant_9051", "plant_9106", "plant_9181", "plant_9194", "plant_9195", "plant_9247", "plant_9267", "plant_9277", "plant_9353", "plant_9372", "plant_9390", "plant_9395", "plant_9527", "plant_9548", "plant_9599", "plant_9616", "plant_9628", "plant_9645", "plant_9659", "plant_9697", "plant_9742", "plant_9855", "plant_9859", "plant_9875", "plant_9891", "plant_9914", "plant_9989", "plant_9993" ], "real_finetune": { "init": "maize_row_ft_e1:checkpoints/checkpoint_epoch_100.pth", "init_epoch": 100, "split_seed": 0, "n_train": 351, "n_val": 39, "n_test": 130, "source": "field1000", "window": "plant", "zoom_aug": true, "epochs": 30, "lr": 2e-05, "batch_size": 16, "recipe_weight": 5.0, "leaf_weight": 5.0, "leaf_scale": [ 0.4000000059604645, 1.2000000476837158, 0.4000000059604645, 180.0, 120.0, 25.0, 40.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], "leaf_shift": [ 0.0, -0.05000000074505806, -0.0, 60.0, 150.0, 0.0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "supervised": [ "pc", "depth", "height", "leafCount", "stemInternodeSum", "leaf.distance", "leaf.leafLength", "leaf.leafWidth", "leaf.avgCurvature" ], "source_mask_ratio": 0.8 }, "epoch": 26}123version https://git-lfs.github.com/spec/v1oid sha256:f71ec778448b89c136eaa38659542ca0ab5cc5d4b491a2cff92b3d3de2472d9bsize 4572042201234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889{ "data_root": "data/Maize", "img_size": 224, "num_points": 8192, "max_plants": null, "plant_subset_seed": 42, "rgb_file": "rgba.png", "param_schema": "v2", "model_size": "base", "active_modalities": null, "mask_ratio": 0.8, "pc_loss_weight": 1.0, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 28, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "batch_size": 16, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "val_max_batches": 100, "max_steps": 0, "accum_steps": 4, "global_batch_expected": 128, "val_at_start": true, "eval_seed": 0, "teacher_checkpoint": "./outputs/maize_4m_pretrain_15k_d2/checkpoints/checkpoint_epoch_1000.pth", "student_init": "./outputs/maize_4m_pretrain_15k_d2/checkpoints/checkpoint_epoch_1000.pth", "expect_init_epoch": 1000, "crossmodal_prob": 0.8, "source_mask_ratio": 0.0, "sources": [ "rgb", "depth", "pc", "text" ], "feat_distill_weight": 1.0, "cls_distill_weight": 0.5, "output_distill_weight": 0.0, "distill_masked_only": true, "viz_source": "pc", "teacher_visible": [ "rgb", "depth", "pc", "text" ], "teacher_source_mask_ratio": 0.5, "allow_all_visible_teacher": false, "target": null, "targets": [], "output_dir": "./outputs/maize_distill_e1_d2", "save_freq": 2, "keep_last": 2, "resume": null, "viz_freq": 10, "num_viz_samples": 6, "world_size": 2, "dist_backend": "nccl", "dist_url": "env://", "dist_timeout_min": 60, "num_workers": 16, "device": "cuda", "use_wandb": true, "species": "maize", "n_params": 14, "n_text_tokens": 29, "global_batch": 128, "micro_batches_per_epoch": 3282, "opt_steps_per_epoch": 821, "teacher_epoch": 1000, "student_init_epoch": 1000, "total_opt_steps": 82100, "train_samples": 105000, "val_samples": 22500, "view_sampling": false, "text_mask_ratio": null, "resumed_from": null, "epoch": 100}123version https://git-lfs.github.com/spec/v1oid sha256:50b889d8baade2e33726fb4fd4858beb0059f848421327a7f79eb58d3ef46cc0size 457204220123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556{ "species": "maize", "row_root": "data/maize_row", "row_mode": "row", "train_split": "train", "val_split": "train", "val_holdout": 500, "holdout_seed": 0, "thetas": null, "img_size": 224, "num_points": 24576, "gt_points": 8192, "view_seed": 42, "sample_per_plant": true, "param_schema": "v2", "rgb_file": "rgba.png", "rgb_gain": null, "rgb_brighten_gain": 1.0, "model_size": "base", "mask_ratio": 0.8, "active_modalities": null, "text_mask_ratio": null, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_loss_weight": 1.0, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 28, "batch_size": 16, "accum_steps": 2, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "output_dir": "./outputs/maize_row_ft_e1", "save_freq": 5, "keep_last": 3, "keep_every": 25, "resume": "./outputs/maize_row_ft_e1/checkpoints/checkpoint_epoch_90.pth", "init_from": "./outputs/maize_4m_pretrain_15k_d2/checkpoints/checkpoint_epoch_1000.pth", "init_schema": "v2", "num_workers": 12, "device": "cuda", "use_wandb": true, "trainer": "row", "world_size": 1, "val_plants": [ "plant_0029", "plant_0079", "plant_0152", "plant_0174", "plant_0236", "plant_0239", "plant_0251", "plant_0279", "plant_0297", "plant_0322", "plant_0349", "plant_0362", "plant_0377", "plant_0431", "plant_0457", "plant_0462", "plant_0467", "plant_0471", "plant_0472", "plant_0475", "plant_0553", "plant_0567", "plant_0574", "plant_0612", "plant_0619", "plant_0630", "plant_0697", "plant_0706", "plant_0793", "plant_0805", "plant_0812", "plant_0855", "plant_0901", "plant_0902", "plant_0937", "plant_0968", "plant_0981", "plant_0987", "plant_10007", "plant_10050", "plant_10099", "plant_1011", "plant_10154", "plant_10160", "plant_10162", "plant_10207", "plant_10235", "plant_10236", "plant_10301", "plant_10337", "plant_10344", "plant_10348", "plant_10356", "plant_10370", "plant_10391", "plant_10422", "plant_1045", "plant_10470", "plant_10529", "plant_10533", "plant_10618", "plant_10660", "plant_1072", "plant_10727", "plant_10774", "plant_1087", "plant_10930", "plant_10935", "plant_10940", "plant_1095", "plant_10976", "plant_11005", "plant_11039", "plant_11058", "plant_11090", "plant_11126", "plant_11134", "plant_1114", "plant_11161", "plant_11174", "plant_11198", "plant_11207", "plant_11225", "plant_11246", "plant_11258", "plant_11269", "plant_11272", "plant_11329", "plant_11332", "plant_11342", "plant_11360", "plant_11399", "plant_11446", "plant_11454", "plant_11473", "plant_11475", "plant_11493", "plant_11510", "plant_11539", "plant_11589", "plant_11596", "plant_11607", "plant_1163", "plant_11652", "plant_11692", "plant_11795", "plant_11806", "plant_11829", "plant_11877", "plant_11937", "plant_12018", "plant_12064", "plant_12081", "plant_12138", "plant_12167", "plant_12184", "plant_12190", "plant_12196", "plant_12201", "plant_12239", "plant_12277", "plant_12333", "plant_12364", "plant_12394", "plant_12406", "plant_1241", "plant_12455", "plant_12480", "plant_12538", "plant_12557", "plant_12572", "plant_1259", "plant_12607", "plant_12611", "plant_12642", "plant_12662", "plant_12687", "plant_12710", "plant_12822", "plant_1287", "plant_12876", "plant_1292", "plant_12940", "plant_12954", "plant_12974", "plant_12992", "plant_12996", "plant_13046", "plant_1305", "plant_13067", "plant_13079", "plant_13085", "plant_13115", "plant_13181", "plant_1323", "plant_13253", "plant_13302", "plant_13309", "plant_13314", "plant_13369", "plant_1340", "plant_13402", "plant_13405", "plant_1348", "plant_13543", "plant_13557", "plant_13587", "plant_13619", "plant_1364", "plant_13641", "plant_13672", "plant_13736", "plant_1374", "plant_13761", "plant_13791", "plant_13857", "plant_13881", "plant_13892", "plant_13931", "plant_13935", "plant_13957", "plant_1396", "plant_13991", "plant_13994", "plant_14012", "plant_14059", "plant_1409", "plant_14101", "plant_14120", "plant_14128", "plant_14147", "plant_14157", "plant_14196", "plant_14199", "plant_1420", "plant_14250", "plant_14257", "plant_14272", "plant_14317", "plant_14326", "plant_14360", "plant_14447", "plant_14507", "plant_14520", "plant_14531", "plant_14555", "plant_14575", "plant_14619", "plant_14726", "plant_14756", "plant_14761", "plant_14767", "plant_14796", "plant_14817", "plant_14888", "plant_14898", "plant_14921", "plant_1501", "plant_1519", "plant_1522", "plant_1529", "plant_1531", "plant_1544", "plant_1548", "plant_1651", "plant_1658", "plant_1705", "plant_1713", "plant_1715", "plant_1781", "plant_1796", "plant_1817", "plant_1835", "plant_1836", "plant_1853", "plant_1870", "plant_1905", "plant_1932", "plant_1974", "plant_2006", "plant_2014", "plant_2102", "plant_2107", "plant_2134", "plant_2155", "plant_2186", "plant_2187", "plant_2247", "plant_2251", "plant_2258", "plant_2275", "plant_2298", "plant_2304", "plant_2315", "plant_2325", "plant_2374", "plant_2386", "plant_2393", "plant_2446", "plant_2568", "plant_2626", "plant_2636", "plant_2654", "plant_2655", "plant_2680", "plant_2685", "plant_2757", "plant_2799", "plant_2837", "plant_2848", "plant_2898", "plant_2901", "plant_2913", "plant_2923", "plant_2985", "plant_2987", "plant_2993", "plant_3037", "plant_3103", "plant_3193", "plant_3243", "plant_3262", "plant_3331", "plant_3368", "plant_3397", "plant_3451", "plant_3467", "plant_3475", "plant_3476", "plant_3525", "plant_3552", "plant_3611", "plant_3661", "plant_3679", "plant_3716", "plant_3731", "plant_3809", "plant_3843", "plant_3884", "plant_3916", "plant_4022", "plant_4077", "plant_4119", "plant_4129", "plant_4180", "plant_4237", "plant_4269", "plant_4321", "plant_4333", "plant_4359", "plant_4432", "plant_4449", "plant_4457", "plant_4468", "plant_4476", "plant_4481", "plant_4519", "plant_4526", "plant_4569", "plant_4599", "plant_4630", "plant_4660", "plant_4668", "plant_4687", "plant_4734", "plant_4760", "plant_4779", "plant_4795", "plant_4800", "plant_4814", "plant_4847", "plant_4851", "plant_4860", "plant_4879", "plant_4885", "plant_4945", "plant_5008", "plant_5014", "plant_5018", "plant_5062", "plant_5093", "plant_5167", "plant_5199", "plant_5218", "plant_5268", "plant_5309", "plant_5323", "plant_5387", "plant_5392", "plant_5469", "plant_5488", "plant_5578", "plant_5582", "plant_5606", "plant_5622", "plant_5654", "plant_5684", "plant_5699", "plant_5779", "plant_5800", "plant_5823", "plant_5824", "plant_5842", "plant_5894", "plant_5916", "plant_5946", "plant_5991", "plant_5999", "plant_6000", "plant_6044", "plant_6049", "plant_6119", "plant_6166", "plant_6198", "plant_6214", "plant_6224", "plant_6263", "plant_6285", "plant_6302", "plant_6368", "plant_6392", "plant_6410", "plant_6425", "plant_6457", "plant_6486", "plant_6493", "plant_6503", "plant_6538", "plant_6574", "plant_6577", "plant_6636", "plant_6661", "plant_6692", "plant_6711", "plant_6785", "plant_6837", "plant_6883", "plant_6892", "plant_7146", "plant_7217", "plant_7263", "plant_7280", "plant_7288", "plant_7325", "plant_7354", "plant_7369", "plant_7404", "plant_7441", "plant_7448", "plant_7481", "plant_7485", "plant_7495", "plant_7506", "plant_7524", "plant_7560", "plant_7581", "plant_7594", "plant_7615", "plant_7630", "plant_7636", "plant_7643", "plant_7656", "plant_7698", "plant_7735", "plant_7739", "plant_7843", "plant_7863", "plant_7930", "plant_7978", "plant_7994", "plant_8018", "plant_8034", "plant_8075", "plant_8096", "plant_8131", "plant_8138", "plant_8139", "plant_8148", "plant_8152", "plant_8269", "plant_8284", "plant_8296", "plant_8313", "plant_8322", "plant_8334", "plant_8341", "plant_8355", "plant_8402", "plant_8407", "plant_8422", "plant_8444", "plant_8479", "plant_8480", "plant_8493", "plant_8504", "plant_8514", "plant_8526", "plant_8544", "plant_8551", "plant_8615", "plant_8646", "plant_8689", "plant_8698", "plant_8799", "plant_8841", "plant_8847", "plant_8875", "plant_8881", "plant_8893", "plant_8974", "plant_9027", "plant_9032", "plant_9051", "plant_9106", "plant_9181", "plant_9194", "plant_9195", "plant_9247", "plant_9267", "plant_9277", "plant_9353", "plant_9372", "plant_9390", "plant_9395", "plant_9527", "plant_9548", "plant_9599", "plant_9616", "plant_9628", "plant_9645", "plant_9659", "plant_9697", "plant_9742", "plant_9855", "plant_9859", "plant_9875", "plant_9891", "plant_9914", "plant_9989", "plant_9993" ], "epoch": 100}123version https://git-lfs.github.com/spec/v1oid sha256:27a4f4dd27f059d011325dca495b9d62f549e321dc9c18048098be7e8a017aecsize 457204220123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "species": "sorghum", "row_root": "data/sorghum_row", "row_mode": "row", "train_split": "train", "val_split": "val", "val_holdout": 0, "holdout_seed": 0, "thetas": null, "img_size": 224, "num_points": 24576, "gt_points": 8192, "view_seed": 42, "sample_per_plant": true, "param_schema": null, "rgb_file": "rgba.png", "rgb_gain": 1.85, "rgb_brighten_gain": 1.85, "leaf_fields": [ "starting_point", "length", "roll_angle", "branching_angle", "width" ], "model_size": "base", "mask_ratio": 0.8, "active_modalities": null, "text_mask_ratio": null, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_loss_weight": 1.0, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 24, "batch_size": 16, "accum_steps": 1, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "output_dir": "./outputs/sorghum_row_ft", "save_freq": 5, "keep_last": 3, "keep_every": 25, "resume": null, "init_from": "./outputs/4m_pretrain_15k_d2_sink/checkpoints/checkpoint_epoch_1000.pth", "init_schema": null, "num_workers": 8, "device": "cuda", "use_wandb": true, "trainer": "row", "world_size": 2, "real_finetune": { "init": "sorghum_row_ft:checkpoints/checkpoint_epoch_100.pth", "init_epoch": 100, "split_seed": 0, "n_train": 33, "n_val": 5, "n_test": 13, "source": "field1000", "window": "plant", "zoom_aug": true, "epochs": 30, "lr": 2e-05, "batch_size": 16, "recipe_weight": 5.0, "leaf_weight": 5.0, "leaf_scale": [ 0.4000000059604645, 0.8500000238418579, 0.15000000596046448, 180.0, 120.0, 25.0, 40.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], "leaf_shift": [ 0.0, -0.05000000074505806, 0.0, 60.0, 150.0, 0.0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "count_slots": true, "count_threshold_m": 0.05, "empty_weight": 0.3, "source_mix": 0.5, "supervised": [ "pc", "depth", "stem_length=height", "leaf.starting_point", "leaf.length", "leaf.width", "leaf.length=0 after the last leaf (count)" ], "source_mask_ratio": 0.8 }, "epoch": 26}123version https://git-lfs.github.com/spec/v1oid sha256:ab88e1d837fcefc36dabe69fc0458d13a96fca866e8bcd4aff20b74c56cb1d59size 4571581121234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162{ "data_root": "data/Sorghum_15K", "img_size": 224, "num_points": 8196, "rgb_file": "rgb_nobg.png", "model_size": "base", "mask_ratio": 0.8, "pc_loss_weight": 1.0, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 24, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "rgb_gain": 1.85, "batch_size": 16, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "val_max_batches": 100, "max_steps": 0, "accum_steps": 4, "teacher_checkpoint": "./outputs/4m_pretrain_15k_d2_sink/checkpoints/checkpoint_epoch_1000.pth", "student_init": "./outputs/4m_pretrain_15k_d2_sink/checkpoints/checkpoint_epoch_1000.pth", "expect_init_epoch": 1000, "crossmodal_prob": 0.8, "source_mask_ratio": 0.0, "sources": [ "rgb", "depth", "pc", "text" ], "feat_distill_weight": 1.0, "cls_distill_weight": 0.5, "output_distill_weight": 0.0, "distill_masked_only": true, "viz_source": "pc", "target": null, "targets": [], "output_dir": "./outputs/4m_distill_15k_all_d2", "save_freq": 2, "keep_last": 2, "resume": "./outputs/4m_distill_15k_all_d2/checkpoints/checkpoint_epoch_46.pth", "viz_freq": 10, "num_viz_samples": 6, "world_size": 2, "dist_backend": "nccl", "dist_url": "env://", "num_workers": 8, "device": "cuda", "use_wandb": true, "rgb_brighten_gain": 1.85, "species": "sorghum", "epoch": 100}123version https://git-lfs.github.com/spec/v1oid sha256:d707026e4fa129c70a047d08d4279616708cb84d031ef449bcd2e21b7bada2e8size 45715811212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061{ "species": "sorghum", "row_root": "data/sorghum_row", "row_mode": "row", "train_split": "train", "val_split": "val", "val_holdout": 0, "holdout_seed": 0, "thetas": null, "img_size": 224, "num_points": 24576, "gt_points": 8192, "view_seed": 42, "sample_per_plant": true, "param_schema": null, "rgb_file": "rgba.png", "rgb_gain": 1.85, "rgb_brighten_gain": 1.85, "leaf_fields": [ "starting_point", "length", "roll_angle", "branching_angle", "width" ], "model_size": "base", "mask_ratio": 0.8, "active_modalities": null, "text_mask_ratio": null, "pc_loss_name": "qal_loss", "qal_threshold": 0.01, "qal_alpha": 100.0, "qal_use_squared": false, "pc_loss_weight": 1.0, "pc_sinkhorn_weight": 0.5, "pc_sinkhorn_points": 1024, "pc_sinkhorn_blur": 0.02, "depth_norm_type": "minmax", "spline_loss_weight": 5.0, "max_leaves": 24, "batch_size": 16, "accum_steps": 1, "epochs": 100, "lr": 0.0001, "weight_decay": 0.05, "warmup_epochs": 5, "val_freq": 5, "output_dir": "./outputs/sorghum_row_ft", "save_freq": 5, "keep_last": 3, "keep_every": 25, "resume": null, "init_from": "./outputs/4m_pretrain_15k_d2_sink/checkpoints/checkpoint_epoch_1000.pth", "init_schema": null, "num_workers": 8, "device": "cuda", "use_wandb": true, "trainer": "row", "world_size": 2, "epoch": 100}123version https://git-lfs.github.com/spec/v1oid sha256:47b72acfb61fb74a83dae9e458fb4e2747894c09ba734a3c62ec171170d0e3bfsize 457158112123torch>=2.1numpysafetensors123version https://git-lfs.github.com/spec/v1oid sha256:709ab96e6262dc2868731c724d9e78db73252d45b3eac40a6814df0c380fd454size 48187712345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394photo,plant_id,plant_number,is_middle_plant,leaf,leaf_fraction_in_photo,leaf_length_m,leaf_width_m,zenith_deg,azimuth_deg,internode_dist_m,twist_deg,curvature_1pm,stem_diameter_mrow936_seed1_stop06_full,0204,8,1,1,1,0.696,0.188,38.1,77.245,0.191,25.2508,3.4444,0.0261row936_seed1_stop06_full,0204,8,1,2,1,0.575,0.354,24.5,224.545,0.155,3.4092,4.1041,0.0275row936_seed1_stop06_full,0204,8,1,3,1,0.868,0.261,35.2,77.445,0.131,2.1004,2.8512,0.0274row936_seed1_stop06_full,0204,8,1,4,1,0.826,0.223,31.5,264.445,0.135,5.93,2.0567,0.027row936_seed1_stop06_full,0204,8,1,5,1,0.871,0.277,35.1,88.645,0.119,-38.3652,2.4676,0.0271row936_seed1_stop06_full,0204,8,1,6,1,0.786,0.204,21.5,264.645,0.154,111.7299,3.0678,0.0256row936_seed1_stop06_full,0204,8,1,7,1,0.728,0.258,33.5,124.845,0.124,34.9066,1.7691,0.0256row936_seed1_stop06_full,0204,8,1,8,1,0.698,0.152,17.4,293.745,0.17,2.9906,1.1573,0.0265row936_seed1_stop06_full,0204,8,1,9,1,0.664,0.155,19.1,108.245,0.129,55.9633,1.288,0.0274row936_seed1_stop06_full,0204,8,1,10,1,0.577,0.138,17.5,287.145,0.139,-2.3943,2.0608,0.03row936_seed1_stop06_full,0204,8,1,11,1,0.423,0.262,13.5,129.345,0.17,33.698,3.0356,0.0293row936_seed1_stop06_full,0202,4,0,1,0.8199,0.475,0.116,43.6,293.842,0.118,-42.7116,6.8902,0.0266row936_seed1_stop06_full,0202,4,0,2,1,0.582,0.154,39.1,124.342,0.081,72.7675,4.0108,0.0259row936_seed1_stop06_full,0202,4,0,3,1,0.647,0.177,36.2,309.842,0.091,48.504,4.7692,0.027row936_seed1_stop06_full,0202,4,0,4,0.934,0.696,0.297,31.7,118.642,0.09,-174.7468,2.894,0.0268row936_seed1_stop06_full,0202,4,0,5,0.845,0.712,0.139,35.9,313.742,0.124,57.7033,5.2613,0.0308row936_seed1_stop06_full,0202,4,0,6,0.837,0.544,0.111,41.4,132.542,0.147,-26.8918,3.2975,0.0313row936_seed1_stop06_full,0202,4,0,7,0.9973,0.638,0.146,39,299.542,0.139,91.5855,5.8036,0.0297row936_seed1_stop06_full,0202,4,0,8,1,0.462,0.159,70.5,82.242,0.227,0.0192,5.7183,0.0285row936_seed1_stop06_full,0202,4,0,9,0.5666,0.514,0.141,25.1,294.242,0.079,31.5707,3.7862,0.0299row936_seed1_stop06_full,0202,4,0,10,0.5977,0.493,0.331,33.2,140.042,0.143,15.3528,18.3209,0.0306row936_seed1_stop06_full,0202,4,0,11,1,0.371,0.12,4.6,346.842,0.165,-77.1666,13.4103,0.0288row936_seed1_stop06_full,0056,5,0,1,0.4994,0.56,0.136,58.6,246.198,0.04,-14.7082,5.3676,0.0256row936_seed1_stop06_full,0056,5,0,2,1,0.63,0.155,59.7,83.898,0.096,22.9712,4.4353,0.0256row936_seed1_stop06_full,0056,5,0,3,0.7752,0.703,0.184,60.1,273.798,0.137,-7.5535,4.0169,0.0256row936_seed1_stop06_full,0056,5,0,4,1,0.731,0.306,49.2,93.998,0.138,5.9361,4.3802,0.0256row936_seed1_stop06_full,0056,5,0,5,0.608,0.757,0.126,57.9,270.598,0.119,113.8166,2.5025,0.0256row936_seed1_stop06_full,0056,5,0,6,1,0.724,0.126,55.4,102.398,0.117,95.1589,2.683,0.0256row936_seed1_stop06_full,0056,5,0,7,0.9943,0.692,0.26,65.8,285.698,0.172,89.7737,3.8937,0.0256row936_seed1_stop06_full,0056,5,0,8,1,0.611,0.165,60.5,116.198,0.1,32.3222,3.4835,0.0256row936_seed1_stop06_full,0056,5,0,9,1,0.596,0.183,53.4,283.198,0.116,163.6875,5.4827,0.0256row936_seed1_stop06_full,0056,5,0,10,1,0.475,0.098,24.9,33.798,0.082,90.3901,8.2268,0.0255row936_seed1_stop06_full,0278,6,0,1,1,0.47,0.093,58,86.132,0.401,83.9563,6.4183,0.0256row936_seed1_stop06_full,0278,6,0,2,1,0.594,0.1,61.5,282.832,0.125,53.3984,3.648,0.0256row936_seed1_stop06_full,0278,6,0,3,0.8721,0.694,0.159,53.6,65.032,0.123,50.0999,3.5279,0.0256row936_seed1_stop06_full,0278,6,0,4,1,0.723,0.171,60,253.332,0.136,39.1093,3.0566,0.0256row936_seed1_stop06_full,0278,6,0,5,1,0.717,0.185,47.6,91.732,0.167,-33.0619,3.7151,0.0256row936_seed1_stop06_full,0278,6,0,6,0.8581,0.758,0.155,47.5,297.532,0.133,29.9513,2.7212,0.0256row936_seed1_stop06_full,0278,6,0,7,1,0.719,0.192,36.2,103.632,0.091,23.7543,4.025,0.0255row936_seed1_stop06_full,0278,6,0,8,1,0.61,0.13,29.9,289.932,0.164,-48.3068,3.6486,0.0256row936_seed1_stop06_full,0278,6,0,9,1,0.636,0.148,56,147.332,0.077,60.7374,1.3807,0.0255row936_seed1_stop06_full,0300,7,0,1,1,0.656,0.097,39.9,84.545,0.296,80.4318,4.1809,0.0256row936_seed1_stop06_full,0300,7,0,2,0.9504,0.872,0.162,28.6,247.845,0.109,3.7697,3.3189,0.0255row936_seed1_stop06_full,0300,7,0,3,0.9984,0.951,0.261,32.6,87.445,0.129,26.1817,3.937,0.0256row936_seed1_stop06_full,0300,7,0,4,1,1.006,0.172,30.8,259.145,0.119,51.3164,3.7343,0.0256row936_seed1_stop06_full,0300,7,0,5,1,1,0.228,45.2,85.145,0.125,140.0296,3.9697,0.0256row936_seed1_stop06_full,0300,7,0,6,1,1.009,0.215,43.5,251.745,0.054,114.2011,3.9048,0.0256row936_seed1_stop06_full,0300,7,0,7,1,0.884,0.206,28.9,93.445,0.143,-58.6143,4.8602,0.0256row936_seed1_stop06_full,0300,7,0,8,1,0.812,0.307,22.8,240.345,0.12,15.4035,7.149,0.0256row936_seed1_stop06_full,0300,7,0,9,1,0.746,0.369,27.1,100.245,0.075,13.9896,6.5568,0.0255row936_seed1_stop06_full,0300,7,0,10,1,0.7,0.198,19.6,247.645,0.047,28.5585,5.8494,0.0256row936_seed1_stop06_full,0300,7,0,11,1,0.631,0.135,26.3,63.445,0.086,-18.6673,7.0434,0.0255row936_seed1_stop06_full,0266,9,0,1,1,0.234,0.104,61.7,145.532,0.038,72.5726,17.3073,0.0328row936_seed1_stop06_full,0266,9,0,2,1,0.414,0.08,51.1,355.032,0.037,112.3698,7.5166,0.0317row936_seed1_stop06_full,0266,9,0,3,1,0.512,0.116,43.4,122.832,0.113,61.9145,6.2319,0.0264row936_seed1_stop06_full,0266,9,0,4,1,0.608,0.129,49.1,307.032,0.157,-77.1314,6.5376,0.042row936_seed1_stop06_full,0266,9,0,5,1,0.649,0.121,40.8,94.132,0.162,-16.5947,4.9175,0.0417row936_seed1_stop06_full,0266,9,0,6,1,0.671,0.185,31.8,330.932,0.14,48.6609,5.6566,0.0307row936_seed1_stop06_full,0266,9,0,7,1,0.568,0.164,37,85.632,0.232,38.8387,7.3529,0.0319row936_seed1_stop06_full,0266,9,0,8,1,0.598,0.175,24.3,309.332,0.122,114.1607,6.573,0.0256row936_seed1_stop06_full,0266,9,0,9,1,0.452,0.071,22.7,110.032,0.178,14.1686,1.579,0.0256row936_seed1_stop06_full,0430,10,0,1,0.9985,0.697,0.162,72.7,342.917,0.126,14.0226,6.8189,0.0266row936_seed1_stop06_full,0430,10,0,2,1,0.821,0.22,51.1,111.517,0.141,-60.586,3.5012,0.0302row936_seed1_stop06_full,0430,10,0,3,0.6693,0.807,0.237,49.3,330.917,0.183,61.7279,3.8077,0.0366row936_seed1_stop06_full,0430,10,0,4,1,1.014,0.215,50.9,129.517,0.133,-116.4637,3.2999,0.0366row936_seed1_stop06_full,0430,10,0,5,0.679,0.836,0.217,52.6,322.717,0.212,83.2104,2.8077,0.0368row936_seed1_stop06_full,0430,10,0,6,1,0.785,0.184,41,99.817,0.194,-75.8602,2.4304,0.0366row936_seed1_stop06_full,0430,10,0,7,1,0.723,0.171,30,8.417,0.212,65.4599,2.816,0.0398row936_seed1_stop06_full,0430,10,0,8,1,0.672,0.243,29.5,160.717,0.148,19.0183,5.7036,0.0402row936_seed1_stop06_full,0430,10,0,9,1,0.609,0.138,27.3,348.717,0.141,140.987,6.7171,0.0292row936_seed1_stop06_full,0329,11,0,1,0.6247,0.382,0.084,51.9,329.173,0.057,74.9877,8.1059,0.0291row936_seed1_stop06_full,0329,11,0,2,1,0.487,0.108,55,148.973,0.096,-83.8865,3.9053,0.0315row936_seed1_stop06_full,0329,11,0,3,0.5706,0.596,0.143,57.9,313.873,0.099,161.9912,5.029,0.0332row936_seed1_stop06_full,0329,11,0,4,1,0.697,0.114,38.1,129.273,0.059,-17.5869,3.0321,0.032row936_seed1_stop06_full,0329,11,0,5,0.5346,0.79,0.165,37.6,289.673,0.05,21.9666,2.2767,0.0313row936_seed1_stop06_full,0329,11,0,6,1,0.799,0.161,37.7,124.773,0.103,-74.0896,2.2906,0.0321row936_seed1_stop06_full,0329,11,0,7,0.5712,0.691,0.2,33.8,302.873,0.143,122.0199,1.8217,0.031row936_seed1_stop06_full,0329,11,0,8,1,0.736,0.14,23.8,90.873,0.101,-144.6403,1.5709,0.026row936_seed1_stop06_full,0329,11,0,9,0.9366,0.653,0.264,17.3,295.573,0.172,-79.8776,1.3627,0.0293row936_seed1_stop06_full,0329,11,0,10,1,0.625,0.341,15.7,129.273,0.097,-91.1407,1.6711,0.032row936_seed1_stop06_full,0329,11,0,11,1,0.541,0.134,15.4,337.473,0.143,27.9517,1.2894,0.0282row936_seed1_stop06_full,0184,12,0,1,1,0.458,0.095,80.3,56.964,0.171,57.1282,3.6157,0.0256row936_seed1_stop06_full,0184,12,0,2,0.1606,0.7,0.136,55.7,250.364,0.11,53.8407,3.6097,0.0256row936_seed1_stop06_full,0184,12,0,3,1,0.757,0.111,55.1,67.064,0.13,108.7747,4.2924,0.0256row936_seed1_stop06_full,0184,12,0,4,1,0.834,0.198,39.2,222.464,0.14,-129.6626,3.5458,0.0256row936_seed1_stop06_full,0184,12,0,5,1,0.904,0.232,49.5,75.664,0.164,37.4128,2.9774,0.0256row936_seed1_stop06_full,0184,12,0,6,0.1377,0.834,0.211,46.8,288.564,0.159,100.3594,4.2216,0.0256row936_seed1_stop06_full,0184,12,0,7,1,0.857,0.196,48.2,80.464,0.183,17.2687,3.5437,0.0256row936_seed1_stop06_full,0184,12,0,8,0.1237,0.783,0.22,43.7,277.164,0.168,88.8426,4.0671,0.0256row936_seed1_stop06_full,0184,12,0,9,1,0.742,0.212,62.9,84.064,0.166,-51.0227,3.3021,0.0256row936_seed1_stop06_full,0184,12,0,10,1,0.642,0.148,58.2,196.764,0.14,105.9896,5.5804,0.0256row936_seed1_stop06_full,0184,12,0,11,1,0.557,0.113,85,86.464,0.153,-21.073,3.2431,0.0256row936_seed1_stop06_full,0184,12,0,12,0.2247,0.61,0.17,72.7,292.864,0.095,37.6926,6.9493,0.0256123version https://git-lfs.github.com/spec/v1oid sha256:fccf10f779190d59a9dceb53ff68e5cccba85937a2995993514b1512b0b9a003size 2241052123version https://git-lfs.github.com/spec/v1oid sha256:9b0998b2df58c1f657cebe34455e4493f96caed3ab67280af2e463194b9ef324size 98422123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115{ "height_m": 1.769519329071045, "leaves": 11, "stem_internode_sum_m": 1.5151808261871338, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.09591982507586216, 0.5686516617696142, 0.12853231621581784, 10.986517667770386, -93.55666637420654, 5.8494724333286285, 1.676340103149414 ], [ 0.11739802535471355, 0.6796765585115168, 0.16198283675287417, 11.891183853149414, -97.26011753082275, 4.6037983149290085, -3.004816770553589 ], [ 0.1397078058080048, 0.7550050069393706, 0.1838189986917227, 12.219840288162231, -97.22111105918884, 3.8408201187849045, -1.6996264457702637 ], [ 0.14669554452144418, 0.8036558458171612, 0.1888021020412758, 13.41490387916565, -100.14510869979858, 3.764772415161133, -2.0417606830596924 ], [ 0.15544581644901356, 0.796992380052501, 0.19812728461812856, 13.523694276809692, -100.73667168617249, 3.734404593706131, -2.9309821128845215 ], [ 0.15574603312829183, 0.769409113651875, 0.19805589017355274, 16.09084725379944, -102.52316951751709, 4.259775951504707, -4.439425468444824 ], [ 0.1581279301364411, 0.7171988759815235, 0.1862435011005923, 20.223535895347595, -98.63572955131531, 4.257436096668243, -4.415185451507568 ], [ 0.15319512118689893, 0.6545574912749714, 0.1778215554031961, 17.9597407579422, -99.23022150993347, 4.831084236502647, 0.015785694122314453 ], [ 0.13442307910953577, 0.5838267784347835, 0.16873214496273015, 20.474901795387268, -97.00108051300049, 4.854141175746918, -2.167149782180786 ], [ 0.1354197999152511, 0.5283375222320359, 0.15458526841678122, 21.01891815662384, -99.94545936584473, 5.201031267642975, 3.5840511322021484 ], [ 0.11469602755749264, 0.4604344300104941, 0.11988160788836488, 19.751864075660706, -91.74175500869751, 4.96448427438736, 2.0270586013793945 ] ]}1234567891011{ "model": "maize-field", "sample": "field_0204_row0936_stop06", "source": "all", "seed": 0, "pred_height_m": 1.77, "pred_leaves": 11, "chamfer_1e-4_m2": 52.37, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:d018e3d378ae52718c6a45a84e08086d45577ed5655c303e30a7de5ebc4a957dsize 9842212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697{ "height_m": 0.7528469562530518, "leaves": 9, "stem_internode_sum_m": 0.8879941701889038, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.10537188210147441, 0.6299976825216476, 0.17930498390354188, 6.874476671218872, -96.72725200653076, 4.762646183371544, -2.8655505180358887 ], [ 0.12508998103573887, 0.6784497518221428, 0.17889036206737696, 13.037935495376587, -97.60504245758057, 4.270104691386223, -4.331414699554443 ], [ 0.13461044035271463, 0.7466967390158459, 0.1850894478721834, 10.597591996192932, -96.83818101882935, 3.9704691618680954, -2.425740957260132 ], [ 0.135313799013403, 0.7789453326739988, 0.18135757716532908, 13.963254690170288, -97.57662534713745, 3.843308985233307, -3.118009567260742 ], [ 0.1329877157954531, 0.7916085068527252, 0.17869463233194693, 9.9739408493042, -99.79015588760376, 3.8696400821208954, -2.8680717945098877 ], [ 0.1295959491967551, 0.7932171170698439, 0.18683717529233057, 10.415453910827637, -100.69258689880371, 3.819756582379341, -4.477975368499756 ], [ 0.1261720795359027, 0.7578949263352115, 0.18587168732094295, 12.394452095031738, -100.84116339683533, 4.107218980789185, -3.238908052444458 ], [ 0.11598564559199875, 0.6976438548721404, 0.18164588483640376, 13.90328049659729, -101.04107737541199, 4.2435891926288605, -6.4926934242248535 ], [ 0.10063686520810222, 0.5658821914447216, 0.1436851284457017, 12.828798294067383, -98.93936276435852, 5.172611773014069, -3.3550643920898438 ] ]}1234567891011{ "model": "maize-field", "sample": "field_0204_row0936_stop06", "source": "depth", "seed": 0, "pred_height_m": 0.753, "pred_leaves": 9, "chamfer_1e-4_m2": 52.09, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:f98937aa195626308fcb8741d1800e328c7761db343ef617ec6eb33dc70e4db8size 98422123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "height_m": 1.635697841644287, "leaves": 12, "stem_internode_sum_m": 1.3612911701202393, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.06614859202725576, 0.4554094363911716, 0.12355318253566594, 21.855450868606567, -89.70115184783936, 6.905470788478851, 3.5783886909484863 ], [ 0.09415872833369265, 0.6061778773835442, 0.1364666482279695, 16.418538093566895, -93.88495445251465, 5.152599886059761, -3.4983932971954346 ], [ 0.11389813592878184, 0.7070267230580924, 0.17145006912127236, 17.615484595298767, -96.99289798736572, 4.118779301643372, -1.4562392234802246 ], [ 0.11753789361622768, 0.7683993870873991, 0.1785054948703273, 16.45110011100769, -98.26308131217957, 3.855600953102112, -1.2899088859558105 ], [ 0.12420718854974488, 0.7965111559733202, 0.18949051185683174, 18.299142122268677, -97.8203558921814, 3.6663874983787537, -2.0171403884887695 ], [ 0.12253060523466175, 0.8222186641283287, 0.18596225061956417, 20.54275095462799, -99.91215705871582, 3.6815520375967026, -2.894444465637207 ], [ 0.12418559974708554, 0.7675902182396328, 0.1808735516797535, 23.7941837310791, -98.47024083137512, 4.0638647973537445, -3.1606531143188477 ], [ 0.12404767459702004, 0.7577802708359656, 0.17751634385461124, 22.017268538475037, -99.22554016113281, 3.961329907178879, -3.7875020503997803 ], [ 0.12054171741815978, 0.6311706304518623, 0.18280773435246545, 25.824068784713745, -98.11794877052307, 5.137407034635544, 1.0048985481262207 ], [ 0.10544986881986063, 0.6408651355749413, 0.15243474472216878, 22.609124779701233, -98.72130632400513, 4.580119252204895, -1.2221121788024902 ], [ 0.10508119024457319, 0.561510941595273, 0.1477663777435776, 21.564570665359497, -99.11081314086914, 4.539575055241585, 5.316071510314941 ], [ 0.09297820468214457, 0.534842594607376, 0.14538660266081394, 24.83546018600464, -95.3442370891571, 4.730616882443428, -7.273139953613281 ] ]}1234567891011{ "model": "maize-field", "sample": "field_0204_row0936_stop06", "source": "pc", "seed": 0, "pred_height_m": 1.636, "pred_leaves": 12, "chamfer_1e-4_m2": 173.02, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:455478b296e0f304dbcd2d660c2d8cabab3bb2807914ecd93ff695c043669851size 9842212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697{ "height_m": 0.8492534160614014, "leaves": 9, "stem_internode_sum_m": 0.9554320573806763, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.10698443810618574, 0.6236940619327243, 0.17394905349536316, 8.365543484687805, -97.72509813308716, 5.00609427690506, -0.2454066276550293 ], [ 0.12641271541137566, 0.7304998437265482, 0.18941407485923278, 13.387995958328247, -98.51329565048218, 4.024571925401688, -1.5489625930786133 ], [ 0.13309216697651394, 0.7749301729075171, 0.18981979176133557, 10.069738626480103, -97.97291994094849, 3.7709295749664307, -2.1299588680267334 ], [ 0.1363924523650475, 0.8212037161967629, 0.1951810150620492, 13.655562400817871, -98.64718437194824, 3.647063300013542, -3.477874994277954 ], [ 0.13518933259232835, 0.8249222593971979, 0.18948524280615509, 7.950916886329651, -102.84662961959839, 3.5200923681259155, -2.116779088973999 ], [ 0.13245443303070115, 0.8071114609981151, 0.1966896682484398, 11.96643590927124, -101.58024787902832, 3.7378214299678802, -4.004751443862915 ], [ 0.13300845821214402, 0.7402778191974875, 0.19700001771748088, 12.576627731323242, -102.95581340789795, 4.299475625157356, -1.6143417358398438 ], [ 0.12143740834947536, 0.7214326894355878, 0.1906508950986101, 14.548137187957764, -101.4621090888977, 4.3608661741018295, -5.216333866119385 ], [ 0.10241999778777355, 0.5830826978616983, 0.14949219449597884, 17.394583225250244, -100.2715802192688, 5.054342746734619, -4.186968803405762 ] ]}1234567891011{ "model": "maize-field", "sample": "field_0204_row0936_stop06", "source": "rgb", "seed": 0, "pred_height_m": 0.849, "pred_leaves": 9, "chamfer_1e-4_m2": 71.92, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:8140acdeb7560762479a934d1a67c5500b0b2ee6de5492c37a9651cd541d610fsize 98422123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124{ "height_m": 1.0080063343048096, "leaves": 12, "stem_internode_sum_m": 0.8547609448432922, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.09674533749737346, 0.3214789742383246, 0.06466241139818862, -3.0571478605270386, -91.88261032104492, 5.852527171373367, 1.7548918724060059 ], [ 0.09915418772629181, 0.3257700334354716, 0.06413947896716898, -2.89206326007843, -92.34499096870422, 5.730868503451347, 3.4847259521484375 ], [ 0.09954418688333311, 0.35148624356841296, 0.06602440142728483, 2.9304975271224976, -94.53431725502014, 5.448626726865768, 0.4035639762878418 ], [ 0.10105904491333728, 0.36694546113317017, 0.0678982731858202, 7.982293367385864, -96.05703592300415, 5.28242364525795, 6.068270206451416 ], [ 0.09990819841486509, 0.38840610216557536, 0.06540692559508177, 11.585551500320435, -97.63309121131897, 5.093913525342941, 6.045527458190918 ], [ 0.08776269685868465, 0.3596517269741568, 0.0671061631880665, 10.876080393791199, -97.79226422309875, 5.564755946397781, 0.36897897720336914 ], [ 0.07628491634555035, 0.3710441746461157, 0.06245218167512334, 16.822763085365295, -95.49758434295654, 5.276121199131012, -2.392967939376831 ], [ 0.0612359234874833, 0.35992830147436905, 0.060837295088660426, 24.680069088935852, -92.82012462615967, 5.304437130689621, -10.629523992538452 ], [ 0.044007600009554615, 0.30274260976539225, 0.058405894871786934, 29.74932610988617, -89.61781024932861, 6.039869785308838, -5.13289213180542 ], [ 0.036773080181674356, 0.2560074469116138, 0.056007208665498354, 34.020899534225464, -85.27323961257935, 6.791848689317703, -7.076175212860107 ], [ 0.03467181972670286, 0.2430122958617993, 0.05378185128298796, 39.15079593658447, -86.36051416397095, 7.162831723690033, -1.7706549167633057 ], [ 0.03401138237135681, 0.22367936338373795, 0.05282673002587668, 40.01728892326355, -83.44891548156738, 7.617203891277313, -3.7023210525512695 ] ]}1234567891011{ "model": "maize-row", "sample": "field_0204_row0936_stop06", "source": "all", "seed": 0, "pred_height_m": 1.008, "pred_leaves": 12, "chamfer_1e-4_m2": 212.46, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:15219111a410b9f2614a74dbf78b5c61976d6a59f5f2c2a9fc78f89a5d26a5a6size 9842212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879{ "height_m": 0.86982262134552, "leaves": 7, "stem_internode_sum_m": 0.7185744643211365, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.08062775255184995, 0.37126451216240497, 0.06398062066160115, 3.8652098178863525, -92.54344582557678, 5.091338604688644, -0.2811408042907715 ], [ 0.08486455209351407, 0.40588516473623315, 0.06621384585753454, 13.370153903961182, -93.99177432060242, 4.610127583146095, 6.934499740600586 ], [ 0.08426897651357912, 0.4386860949046074, 0.06502502819001776, 13.295180797576904, -95.96184253692627, 4.430990666151047, -3.120560646057129 ], [ 0.08620013127029136, 0.44626843625183454, 0.06367820158315496, 14.590387344360352, -97.39156007766724, 4.344001039862633, 2.5233864784240723 ], [ 0.08215805414554556, 0.47087069812755544, 0.06423316406143353, 17.649988532066345, -96.82631850242615, 4.130975157022476, -5.132472515106201 ], [ 0.07709630842650395, 0.46659096232311725, 0.06420436607616598, 18.156400322914124, -97.0731246471405, 4.243113100528717, 3.3077216148376465 ], [ 0.0662439356184592, 0.45383489445089964, 0.06322145713255622, 22.92008399963379, -95.93376874923706, 4.345151036977768, -3.1571996212005615 ] ]}1234567891011{ "model": "maize-row", "sample": "field_0204_row0936_stop06", "source": "depth", "seed": 0, "pred_height_m": 0.87, "pred_leaves": 7, "chamfer_1e-4_m2": 340.2, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:cbf48f27ec533095d7cf016414f43cbbfd065d397fcd195ad060500f7a240d05size 98422123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160{ "height_m": 0.9608832001686096, "leaves": 16, "stem_internode_sum_m": 0.8211052417755127, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.07580829971743075, 0.32543567670087725, 0.06535620949094323, 9.370561838150024, -90.85500240325928, 5.685630813241005, 0.1281118392944336 ], [ 0.07609620803737949, 0.3346449134618368, 0.06500433047629706, 9.951066970825195, -90.55490255355835, 5.50912469625473, -0.12878179550170898 ], [ 0.07612552160211683, 0.34889455456472973, 0.06790400417264308, 11.92050039768219, -92.68917560577393, 5.421556904911995, -1.2190580368041992 ], [ 0.07665950770168761, 0.3626467770116264, 0.06598513388574645, 13.585787415504456, -93.95847201347351, 5.299066007137299, -0.28134584426879883 ], [ 0.07682240123782158, 0.39029001579502065, 0.0651702966360368, 14.896641969680786, -95.4102873802185, 4.961260408163071, -2.5152790546417236 ], [ 0.07502608411052947, 0.39365782584079057, 0.06261201451667198, 17.833510637283325, -96.26324772834778, 5.000116676092148, -0.29448747634887695 ], [ 0.07383467069021865, 0.39846537867091314, 0.06382497653663055, 20.26585578918457, -95.7134735584259, 4.916444793343544, -1.8014717102050781 ], [ 0.067331106473969, 0.39485623090179445, 0.06388191983627944, 25.56048274040222, -93.86595368385315, 4.875622317194939, -0.43549180030822754 ], [ 0.06184618565210975, 0.382097123192608, 0.06320154172982928, 30.245872735977173, -93.47034215927124, 5.044200271368027, -0.4157984256744385 ], [ 0.05066061095387653, 0.3618457546383702, 0.061081072135014125, 32.1492862701416, -91.75756216049194, 5.25069460272789, 1.730642318725586 ], [ 0.043209183859961975, 0.34045135671991034, 0.058348509007633, 36.0249924659729, -90.40335416793823, 5.4763298481702805, -2.9055941104888916 ], [ 0.03309463311872829, 0.3041059513139288, 0.056363580380422995, 37.5855016708374, -87.38034725189209, 5.913513898849487, -0.3979933261871338 ], [ 0.03485611729109461, 0.29121364808155903, 0.05535746138721542, 39.12896275520325, -86.83904886245728, 6.149132177233696, -2.251647710800171 ], [ 0.03012548729964326, 0.25808725270172417, 0.05449301220945557, 40.18136501312256, -84.54998731613159, 6.702486425638199, -0.9076595306396484 ], [ 0.02992009565115117, 0.24619774102141534, 0.05309560807925884, 42.8899347782135, -83.49301099777222, 6.913506984710693, 0.38908958435058594 ], [ 0.02739652436072415, 0.24251480120987878, 0.05241938739694696, 43.12510013580322, -82.36483812332153, 6.911640614271164, 0.9924411773681641 ] ]}1234567891011{ "model": "maize-row", "sample": "field_0204_row0936_stop06", "source": "pc", "seed": 0, "pred_height_m": 0.961, "pred_leaves": 16, "chamfer_1e-4_m2": 258.57, "true_height_m": 1.911, "true_leaves": 11}123version https://git-lfs.github.com/spec/v1oid sha256:b736f4f2d7d9fd03c34d1e7930ff46e4671203e6d9e6cca6ba2a544869c4a14csize 9842212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879{ "height_m": 0.7316195964813232, "leaves": 7, "stem_internode_sum_m": 0.6866316199302673, "leaf_fields": [ "distance", "leafLength", "leafWidth", "leafAngle", "droopiness", "avgCurvature", "azJitterDeg" ], "leaf": [ [ 0.09396658679793157, 0.3412815615280671, 0.06644148494567403, 4.552472233772278, -93.60059380531311, 5.601818487048149, -1.0268235206604004 ], [ 0.10189595374309945, 0.35845180199466853, 0.06861623351241075, 7.601779103279114, -94.6898603439331, 5.324076861143112, 0.5628013610839844 ], [ 0.09948053508222898, 0.3884903056496114, 0.06613744760105789, 12.926881313323975, -97.3092770576477, 5.057687684893608, -0.3116798400878906 ], [ 0.10191490802042047, 0.4199386856906884, 0.06833995256185332, 17.52604365348816, -97.86089658737183, 4.725809022784233, 1.3922500610351562 ], [ 0.09125948088257729, 0.39273835115364975, 0.06669372883215452, 17.02443838119507, -96.4195203781128, 5.002675950527191, 0.5340194702148438 ], [ 0.07479104511128432, 0.375516484122528, 0.06547734699556607, 24.93582844734192, -94.30993795394897, 5.226344615221024, -1.352386474609375 ], [ 0.06560984947696102, 0.36662655690316726, 0.06287675749765853, 27.82547950744629, -93.21783900260925, 5.247367545962334, -1.5394282341003418 ] ]}LICENSEAdded+202
README.mdAdded+115
SHA256SUMSAdded+168
cropcode_model/embodied_mae.pyAdded+870
cropcode_model/embodied_mae_4m.pyAdded+1191
cropcode_model/embodied_mae_4m_maize.pyAdded+385
cropcode_model/pc_sinkhorn.pyAdded+55
inference.pyAdded+130
models/maize-field/config.jsonAdded+616
models/maize-field/model.safetensorsAdded+3
models/maize-generalist/config.jsonAdded+89
models/maize-generalist/model.safetensorsAdded+3
models/maize-row/config.jsonAdded+556
models/maize-row/model.safetensorsAdded+3
models/sorghum-field/config.jsonAdded+123
models/sorghum-field/model.safetensorsAdded+3
models/sorghum-generalist/config.jsonAdded+62
models/sorghum-generalist/model.safetensorsAdded+3
models/sorghum-row/config.jsonAdded+61
models/sorghum-row/model.safetensorsAdded+3
requirements.txtAdded+3
samples/maize/field_0204_row0936_stop06/input_rgb.pngAdded

Large File Pointer Details
- SHA256: 84d47a89638a3e32401574ea5fcc308d9e758cd9f757d0fa8a9ea72ed640db17
- Pointer size: 130 Bytes
- Size of remote file: 47.1 kB
samples/maize/field_0204_row0936_stop06/inputs.npzAdded+3
samples/maize/field_0204_row0936_stop06/preview.pngAdded

Large File Pointer Details
- SHA256: 946d6a6baa1644ec52c5097d9a387f859572468fa50483254cd216acbabb5673
- Pointer size: 131 Bytes
- Size of remote file: 271 kB
samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.csvAdded+94
samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.pcdAdded+3
samples/maize/field_0204_row0936_stop06/raw/row936_seed1_stop06_full.pngAdded

Large File Pointer Details
- SHA256: 921133620ac1bda55a1754da85ba550bb047d5f4078bdd9417309536f82ce479
- Pointer size: 132 Bytes
- Size of remote file: 8.13 MB
samples/maize/field_0204_row0936_stop06/reference/maize-field__all/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-field__all/recipe.jsonAdded+115
samples/maize/field_0204_row0936_stop06/reference/maize-field__all/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/recipe.jsonAdded+97
samples/maize/field_0204_row0936_stop06/reference/maize-field__depth/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/recipe.jsonAdded+124
samples/maize/field_0204_row0936_stop06/reference/maize-field__pc/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/recipe.jsonAdded+97
samples/maize/field_0204_row0936_stop06/reference/maize-field__rgb/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-row__all/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-row__all/recipe.jsonAdded+124
samples/maize/field_0204_row0936_stop06/reference/maize-row__all/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/recipe.jsonAdded+79
samples/maize/field_0204_row0936_stop06/reference/maize-row__depth/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/recipe.jsonAdded+160
samples/maize/field_0204_row0936_stop06/reference/maize-row__pc/summary.jsonAdded+11
samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/pred_cloud.plyAdded+3
samples/maize/field_0204_row0936_stop06/reference/maize-row__rgb/recipe.jsonAdded+79