RefSeg-CA / source /code /package_public_source.py
nmsofficial's picture
Add verified public availability and human-evaluation guide
9126e0d verified
Raw
History Blame Contribute Delete
5.82 kB
"""Stage a source repository without credentials, upstream data, or vendored TeX."""
from pathlib import Path
import hashlib,json,shutil,zipfile
ROOT=Path(__file__).resolve().parents[1]
DEST=ROOT.parent/'publish/RefSeg-CA'
README='''# RefSeg-CA — R3 research release
Evaluating and repairing command compliance in generalized referring segmentation.
The release contains the SFAP parser/projection, benchmark generator, inference/evaluation scripts, exact-score replay, Slurm examples, editable TikZ/PGFPlots sources, and a current manuscript. Human validation has **not been conducted**. No acceptance or publication claim is made.
## Data and exact metric replay
Data repository: https://huggingface.co/datasets/Ethosoft/RefSeg-CA
From this directory, with Python 3.9 or newer:
```bash
python code/download_release_data.py
python code/verify_portable_results.py
```
The lightweight download reconstructs 30 primary table rows and 22 reviewer-requested threshold configurations. It requires no TRUBA connection or model weights. These are derived scores; reproducing inference pixels requires upstream models and inputs.
To obtain all 1,200 procedural scenes, both rendering styles, visible-instance maps, and command masks:
```bash
python code/download_release_data.py --synthetic
```
The default data revision is the immutable release tag `r3-data-v1`. Natural images and original gRefCOCO expression text must be obtained from the pinned upstream release; model checkpoint hashes and preparation scripts are under protocol/ and legacy_project/code/.
## Manuscript and figures
The current PDF is distributed alongside this source archive in the data repository under `release/RefSeg_CA_MVA.pdf`. Install the official Springer Nature LaTeX template and normal TeX Live packages, placing sn-jnl.cls and sn-mathphys-num.bst alongside the manuscript as instructed by Springer. The repository does not redistribute these third-party generated files.
```bash
python code/figures_r3.py
python code/build_latex.py
```
The synthetic download is required before regenerating image panels. All written figures are monochrome vector graphics; the experimental raster inputs retain their colors.
## Human evaluation
Read review/HUMAN_VALIDATION_PROTOCOL.md and review/INSAN_DEGERLENDIRMESI_UYGULAMA_KILAVUZU.md. Two independent readers, pre-adjudication agreement, adjudicated semantic labels, and a separate image-aware harm audit are still needed. Automated checks are not human labels.
## Provenance and reuse
See REPRODUCIBILITY.md, THIRD_PARTY.md, CITATION.cff, and SHA256SUMS. This public deposit establishes accessibility. Authors have not yet selected an additional blanket reuse license for original material; existing per-file third-party terms continue to apply.
Browse all source files at https://huggingface.co/datasets/Ethosoft/RefSeg-CA/tree/main/source. This organization-owned Hugging Face source tree is the code host for this release.
'''
def main():
DEST.mkdir(parents=True,exist_ok=True)
patterns=['code/*.py','legacy_project/code/*.py','legacy_project/protocol/*.json',
'legacy_project/results/analysis/*.json','protocol/*.json','protocol/*.md',
'results/analysis/*.json','results/r3/review_results.json','results/r3/jobs/*.json',
'figures/*.tex','figures/*.json','latex/*.tex','latex/*.bib','slurm/*.sbatch']
selected=set()
for pattern in patterns:selected.update(ROOT.glob(pattern))
for p in selected:
out=DEST/p.relative_to(ROOT);out.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(p,out)
for rel in ['CITATION.cff','REPRODUCIBILITY.md','requirements-analysis.txt',
'review/HUMAN_VALIDATION_PROTOCOL.md','review/INSAN_DEGERLENDIRMESI_UYGULAMA_KILAVUZU.md',
'review/Response_to_Major_Revision.md']:
out=DEST/rel;out.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/rel,out)
(DEST/'README.md').write_text(README)
(DEST/'THIRD_PARTY.md').write_text('''# Third-party materials
Original natural images and gRefCOCO expression files are not included. Obtain them from https://huggingface.co/datasets/FudanCVL/gRefCOCO at revision 81eede59b3ac070049f597d023c0ff08d1fb80e9 and the image sources referenced by its authors. They retain their original terms.
Model weights and ReLA source are downloaded from their authors using the revisions and hashes in protocol/. No model weights are redistributed here.
The Springer Nature LaTeX class/bibliography style and standard algorithm packages must be installed from their official distributions. These generated third-party files are omitted from this public source archive. The user-facing manuscript source remains included.
This repository adds no blanket license to material owned by others. The project authors have not yet assigned a blanket reuse license to their original code or procedural dataset.
''')
(DEST/'.gitignore').write_text('build/\ncache/\nassets/\nvendor/\n__pycache__/\n*.pyc\n.env*\n*.token\ndata/rich/\ndata/natural/\nresults/r3/portable/\n*.aux\n*.log\n*.out\n*.blg\n')
files=sorted(p for p in DEST.rglob('*') if p.is_file() and '.git' not in p.parts and p.name!='SHA256SUMS')
(DEST/'SHA256SUMS').write_text(''.join(hashlib.sha256(p.read_bytes()).hexdigest()+' '+p.relative_to(DEST).as_posix()+'\n' for p in files))
archive=ROOT.parent/'RefSeg_CA_R3_Public_Source.zip'
with zipfile.ZipFile(archive,'w',zipfile.ZIP_DEFLATED,compresslevel=6) as z:
for p in files+[DEST/'SHA256SUMS']:z.write(p,'RefSeg-CA/'+p.relative_to(DEST).as_posix())
print(json.dumps({'source_root':str(DEST),'archive':str(archive),'files':len(files)+1,'bytes':archive.stat().st_size,'sha256':hashlib.sha256(archive.read_bytes()).hexdigest()}))
if __name__=='__main__':main()