-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b27f504
commit 259308c
Showing
1 changed file
with
14 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
a "optoseg/src/algo/grid" | ||
"sync" | ||
) | ||
import "autoseg" | ||
|
||
func main() { | ||
config := a.Config{ | ||
AdjBiasRange: [2]float64{-1.0, 1.0}, | ||
LrBiasRange: [2]float64{-1.0, 1.0}, | ||
NumSteps: 10, | ||
} | ||
|
||
// Create a channel to receive scores from goroutines | ||
scoresChan := make(chan a.Score, config.NumSteps) | ||
|
||
// Use a WaitGroup to wait for all goroutines to finish | ||
var wg sync.WaitGroup | ||
|
||
// Launch goroutines | ||
for i := 0; i < config.NumSteps; i++ { | ||
wg.Add(1) | ||
go a.GridSearch(config, "rand_voi", scoresChan, &wg) | ||
} | ||
|
||
// Close the channel when all goroutines are done | ||
go func() { | ||
wg.Wait() | ||
close(scoresChan) | ||
}() | ||
|
||
// Collect results from the channel | ||
var results []a.Score | ||
for score := range scoresChan { | ||
results = append(results, score) | ||
} | ||
|
||
for _, result := range results { | ||
fmt.Printf("ABias: %.2f, LBias: %.2f, Fitness: %.4f\n", result.ABias, result.LBias, result.Fitness) | ||
} | ||
} | ||
trainingParams := []struct { | ||
modelType string | ||
scriptPath string | ||
args []string | ||
}{ | ||
{"MTLSD", "./scripts/mtlsd_train.sh", []string{"--iterations", "100000", "--raw_file", "path/to/zarr/or/n5", "--voxel_size", "33"}}, | ||
{"ACLSD", "./scripts/aclsd_train.sh", []string{"--iterations", "100000", "--raw_file", "path/to/zarr/or/n5", "--warmup", "100000"}}, | ||
{"STELARR", "./scripts/stelarr_train.sh", []string{"--iterations", "100000", "--raw_file", "path/to/zarr/or/n5", "--warmup", "100000"}}, | ||
// Add more parameter sets as needed | ||
} | ||
|
||
autoseg.RunTrainingInParallel(trainingParams) | ||
} |