GithubHelp home page GithubHelp logo

Comments (5)

ppogg avatar ppogg commented on May 16, 2024

Hi, friend, I don't know what you mean? Could you talk more in detail?

from yolov5-lite.

larrywal-express avatar larrywal-express commented on May 16, 2024

After training completion, figure of Recall, Precision, and F1 are generated. Now, how to generate the txt file for Recall vs Confidence, Precision vs Confidence, and F1 vs Confidence?

from yolov5-lite.

ppogg avatar ppogg commented on May 16, 2024

Actually, you can draw and save txt files by using test.py
The code to save the txt file is as follows:

# Append to text file
            if save_txt:
                gn = torch.tensor(shapes[si][0])[[1, 0, 1, 0]]  # normalization gain whwh
                for *xyxy, conf, cls in predn.tolist():
                    xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist()  # normalized xywh
                    line = (cls, *xywh, conf) if save_conf else (cls, *xywh)  # label format
                    with open(save_dir / 'labels' / (path.stem + '.txt'), 'a') as f:
                        f.write(('%g ' * len(line)).rstrip() % line + '\n')

Please remember to set python test.py --save-txt When you use it

from yolov5-lite.

larrywal-express avatar larrywal-express commented on May 16, 2024

not this.. i mean in the metrics.py file..

def plot_mc_curve(px, py, save_dir='mc_curve.png', names=(), xlabel='Confidence', ylabel='Metric'):
# Metric-confidence curve
fig, ax = plt.subplots(1, 1, figsize=(9, 6), tight_layout=True)

if 0 < len(names) < 21:  # display per-class legend if < 21 classes
    for i, y in enumerate(py):
        ax.plot(px, y, linewidth=1, label=f'{names[i]}')  # plot(confidence, metric)
else:
    ax.plot(px, py.T, linewidth=1, color='grey')  # plot(confidence, metric)

y = py.mean(0)
ax.plot(px, y, linewidth=3, color='blue', label=f'all classes {y.max():.2f} at {px[y.argmax()]:.3f}')
ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel)
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
fig.savefig(Path(save_dir), dpi=250)

i added the line below but not working
np.savetxt(Path(names + '.txt'), np.column_stack([px,y]))

from yolov5-lite.

larrywal-express avatar larrywal-express commented on May 16, 2024

i mean how to obtain it in txt file apart from the figure plot

from yolov5-lite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.