Skip to content

Commit 17620db

Browse files
fixmie[bot]abduld
fixmie[bot]
and
abduld
authored
Apply suggestions from code review
Co-Authored-By: abduld <[email protected]>
1 parent 22dc3a5 commit 17620db

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

reader/tfrecord.go

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ func (r *TFRecordReader) Next(ctx context.Context) (*ImageRecord, error) {
9292
}, nil
9393
}
9494

95+
// Close ...
9596
func (r *TFRecordReader) Close() error {
9697
return r.r.Close()
9798
}

reader/tfrecord/features.go

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func FeatureInt32(rec *protobuf.Example, key string) int32 {
3232
return int32(FeatureInt64(rec, key))
3333
}
3434

35+
// FeatureFloat64 ...
3536
func FeatureFloat64(rec *protobuf.Example, key string) float64 {
3637
return float64(FeatureFloat32(rec, key))
3738
}
@@ -55,10 +56,12 @@ func FeatureBytes(rec *protobuf.Example, key string) []byte {
5556
return terf.ExampleFeatureBytes(rec, key)
5657
}
5758

59+
// FeatureString ...
5860
func FeatureString(rec *protobuf.Example, key string) string {
5961
return string(FeatureBytes(rec, key))
6062
}
6163

64+
// FeatureBytesSlice ...
6265
func FeatureBytesSlice(rec *protobuf.Example, key string) [][]byte {
6366
// TODO: return error if key is not found?
6467
f, ok := rec.Features.Feature[key]
@@ -88,6 +91,7 @@ func FeatureStringSlice(rec *protobuf.Example, key string) []string {
8891
return res
8992
}
9093

94+
// FeatureInt64Slice ...
9195
func FeatureInt64Slice(rec *protobuf.Example, key string) []int64 {
9296

9397
f, ok := rec.Features.Feature[key]
@@ -118,6 +122,7 @@ func FeatureIntSlice(rec *protobuf.Example, key string) []int {
118122
return res
119123
}
120124

125+
// FeatureInt32Slice ...
121126
func FeatureInt32Slice(rec *protobuf.Example, key string) []int32 {
122127
slice := FeatureInt64Slice(rec, key)
123128
if slice == nil {
@@ -132,6 +137,7 @@ func FeatureInt32Slice(rec *protobuf.Example, key string) []int32 {
132137
return res
133138
}
134139

140+
// FeatureFloat64Slice ...
135141
func FeatureFloat64Slice(rec *protobuf.Example, key string) []float64 {
136142
slice := FeatureFloat32Slice(rec, key)
137143
if slice == nil {

vision/cityscape_class.go

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package vision
22

3+
// CityScapeClass ...
34
type CityScapeClass struct {
45
Name string
56
ID int64
@@ -11,6 +12,7 @@ type CityScapeClass struct {
1112
Color []uint8
1213
}
1314

15+
// CityScapeClasses ...
1416
var CityScapeClasses []CityScapeClass
1517

1618
func init() {

vision/coco.go

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type CocoLabeledImage struct {
3434
data *types.RGBImage
3535
}
3636

37+
// CocoValidationTFRecord ...
3738
type CocoValidationTFRecord struct {
3839
base
3940
name string
@@ -68,17 +69,20 @@ func (d *CocoLabeledImage) Features() dlframework.Features {
6869
return d.features
6970
}
7071

72+
// Close ...
7173
func (d *CocoValidationTFRecord) Close() error {
7274
if d.recordReader != nil {
7375
d.recordReader.Close()
7476
}
7577
return nil
7678
}
7779

80+
// Name ...
7881
func (d *CocoValidationTFRecord) Name() string {
7982
return d.name
8083
}
8184

85+
// CanonicalName ...
8286
func (d *CocoValidationTFRecord) CanonicalName() string {
8387
category := strings.ToLower(d.Category())
8488
name := strings.ToLower(d.Name())
@@ -92,6 +96,7 @@ func (d *CocoValidationTFRecord) workingDir() string {
9296
return filepath.Join(d.baseWorkingDir, category, name)
9397
}
9498

99+
// Download ...
95100
func (d *CocoValidationTFRecord) Download(ctx context.Context) error {
96101
workingDir := d.workingDir()
97102
fileName := d.recordFileName
@@ -110,14 +115,17 @@ func (d *CocoValidationTFRecord) Download(ctx context.Context) error {
110115
return nil
111116
}
112117

118+
// New ...
113119
func (d *CocoValidationTFRecord) New(ctx context.Context) (dldataset.Dataset, error) {
114120
return nil, nil
115121
}
116122

123+
// Get ...
117124
func (d *CocoValidationTFRecord) Get(ctx context.Context, name string) (dldataset.LabeledData, error) {
118125
return nil, errors.New("get is not implemented for " + d.CanonicalName())
119126
}
120127

128+
// List ...
121129
func (d *CocoValidationTFRecord) List(ctx context.Context) ([]string, error) {
122130
return nil, errors.New("list is not implemented for " + d.CanonicalName())
123131
}
@@ -137,6 +145,7 @@ func (d *CocoValidationTFRecord) loadRecord(ctx context.Context) error {
137145
return nil
138146
}
139147

148+
// Load ...
140149
func (d *CocoValidationTFRecord) Load(ctx context.Context) error {
141150
return d.loadRecord(ctx)
142151
}

0 commit comments

Comments
 (0)