Skip to content

Commit

Permalink
Main.go updates
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreicher committed Nov 27, 2023
1 parent b27f504 commit 259308c
Showing 1 changed file with 14 additions and 39 deletions.
53 changes: 14 additions & 39 deletions optoseg/src/main.go
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)
}

0 comments on commit 259308c

Please sign in to comment.