Backend: Adjust log levels and messages

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-20 11:29:38 +02:00
parent 5118d3a604
commit 9a2b75781e
5 changed files with 8 additions and 8 deletions

View file

@ -71,7 +71,7 @@ func (t *TensorFlow) Labels(img []byte) (result Labels, err error) {
tensor, err := t.createTensor(img, "jpeg")
if err != nil {
return nil, fmt.Errorf("classify: %s (create tensor)", err.Error())
return nil, fmt.Errorf("classify: %s", err)
}
// Run inference.

View file

@ -53,7 +53,7 @@ func (t *Detector) Labels(img []byte) (result Labels, err error) {
tensor, err := createTensorFromImage(img, "jpeg")
if err != nil {
return result, fmt.Errorf("nsfw: %s (create tensor)", err.Error())
return result, fmt.Errorf("nsfw: %s", err)
}
// Run inference

View file

@ -13,13 +13,13 @@ import (
// Colors returns the ColorPerception of an image (only JPEG supported).
func (m *MediaFile) Colors(thumbPath string) (perception colors.ColorPerception, err error) {
if !m.IsJpeg() {
return perception, fmt.Errorf("%s is not a jpeg file (detect colors)", txt.Quote(m.BaseName()))
return perception, fmt.Errorf("colors: %s is not a jpeg", txt.Quote(m.BaseName()))
}
img, err := m.Resample(thumbPath, "colors")
if err != nil {
log.Errorf("%s (detect colors)", err.Error())
log.Debugf("colors: %s in %s (resample)", err, txt.Quote(m.BaseName()))
return perception, err
}

View file

@ -739,14 +739,14 @@ func (ind *Index) classifyImage(jpeg *MediaFile) (results classify.Labels) {
filename, err := jpeg.Thumbnail(Config().ThumbPath(), thumb)
if err != nil {
log.Error(err)
log.Debugf("%s in %s", err, txt.Quote(jpeg.BaseName()))
continue
}
imageLabels, err := ind.tensorFlow.File(filename)
if err != nil {
log.Error(err)
log.Debugf("%s in %s", err, txt.Quote(jpeg.BaseName()))
continue
}

View file

@ -141,7 +141,7 @@ func FromFile(imageFilename, hash, thumbPath string, width, height int, opts ...
img, err := imaging.Open(imageFilename, imaging.AutoOrientation(true))
if err != nil {
log.Errorf("resample: can't open %s (%s)", txt.Quote(imageFilename), err.Error())
log.Errorf("resample: %s in %s", err, txt.Quote(filepath.Base(imageFilename)))
return "", err
}
@ -176,7 +176,7 @@ func Create(img image.Image, fileName string, width, height int, opts ...Resampl
err = imaging.Save(result, fileName, saveOption)
if err != nil {
log.Errorf("resample: failed to save %s", fileName)
log.Errorf("resample: failed to save %s", txt.Quote(filepath.Base(fileName)))
return result, err
}